Extendipedia extendipediawiki https://extendipedia.miraheze.org/wiki/Main_Page MediaWiki 1.40.1 first-letter Media Special Talk User User talk Extendipedia Extendipedia talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk Module Module talk Template:Location map 10 40 81 2017-03-16T00:55:26Z wikipedia>Plastikspork 0 TFD closed as no consensus (using [[User:Evad37/TFDcloser|TFDcloser]]) wikitext text/x-wiki <includeonly>{{#invoke:Location map|main}}</includeonly><noinclude>{{documentation}}</noinclude> 732416b8068d2dc3549db5aa5ffa786beb502886 Module:Citation 828 13 26 2018-05-21T11:38:53Z wikipedia>Pppery 0 Rm unreachable code Scribunto text/plain error('This module is retained for historical and structural reasons; consider using [[Module:Citation/CS1]].') b09b01dacd314f37060769a4fc6b8f027c247b86 27 26 2023-08-02T22:42:08Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain error('This module is retained for historical and structural reasons; consider using [[Module:Citation/CS1]].') b09b01dacd314f37060769a4fc6b8f027c247b86 Template:Infobox 10 11 22 2018-08-15T18:33:36Z wikipedia>Primefac 0 Undid revision 855063393 by [[Special:Contributions/Jdlrobson|Jdlrobson]] ([[User talk:Jdlrobson|talk]]) rather problematic change mentioned [[Template_talk:Infobox#Using_template_styles_to_reduce_technical_debt_inside_mobile_skin|on talk page]], reverting until it can be sorted wikitext text/x-wiki {{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude> {{documentation}} <!-- Categories go in the /doc subpage, and interwikis go in Wikidata. --> </noinclude> 817a9f5b6524eced06a57bd1d5fd7179f9369bf2 23 22 2023-08-02T22:42:08Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) wikitext text/x-wiki {{#invoke:Infobox|infobox}}<includeonly>{{template other|{{#ifeq:{{PAGENAME}}|Infobox||{{#ifeq:{{str left|{{SUBPAGENAME}}|7}}|Infobox|[[Category:Infobox templates|{{remove first word|{{SUBPAGENAME}}}}]]}}}}|}}</includeonly><noinclude> {{documentation}} <!-- Categories go in the /doc subpage, and interwikis go in Wikidata. --> </noinclude> 817a9f5b6524eced06a57bd1d5fd7179f9369bf2 Template:Template other 10 35 71 2018-12-16T22:06:25Z wikipedia>Amorymeltzer 0 Changed protection level for "[[Template:Template other]]": [[WP:High-risk templates|Highly visible template]]: Transclusion count has increased dramatically ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) wikitext text/x-wiki {{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:Template}} | template | other }} }} | template = {{{1|}}} | other | #default = {{{2|}}} }}<!--End switch--><noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude> 06fb13d264df967b5232141067eb7d2b67372d76 Module:Arguments 828 19 38 2020-04-01T06:12:40Z wikipedia>MusikAnimal 0 1 revision imported Scribunto text/plain -- This module provides easy processing of arguments passed to Scribunto from -- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly. local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local arguments = {} -- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it. local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == '' then return nil else return val end else return val end end local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end local function tidyValNoChange(key, val) return val end local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end local translate_mt = { __index = function(t, k) return k end } function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {} --[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end --[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', '') local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end -- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end -- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs --[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end --[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable) local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end --[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]] metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end return args end return arguments 3134ecce8429b810d445e29eae115e2ae4c36c53 39 38 2023-08-02T22:42:11Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain -- This module provides easy processing of arguments passed to Scribunto from -- #invoke. It is intended for use by other Lua modules, and should not be -- called from #invoke directly. local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local arguments = {} -- Generate four different tidyVal functions, so that we don't have to check the -- options every time we call it. local function tidyValDefault(key, val) if type(val) == 'string' then val = val:match('^%s*(.-)%s*$') if val == '' then return nil else return val end else return val end end local function tidyValTrimOnly(key, val) if type(val) == 'string' then return val:match('^%s*(.-)%s*$') else return val end end local function tidyValRemoveBlanksOnly(key, val) if type(val) == 'string' then if val:find('%S') then return val else return nil end else return val end end local function tidyValNoChange(key, val) return val end local function matchesTitle(given, title) local tp = type( given ) return (tp == 'string' or tp == 'number') and mw.title.new( given ).prefixedText == title end local translate_mt = { __index = function(t, k) return k end } function arguments.getArgs(frame, options) checkType('getArgs', 1, frame, 'table', true) checkType('getArgs', 2, options, 'table', true) frame = frame or {} options = options or {} --[[ -- Set up argument translation. --]] options.translate = options.translate or {} if getmetatable(options.translate) == nil then setmetatable(options.translate, translate_mt) end if options.backtranslate == nil then options.backtranslate = {} for k,v in pairs(options.translate) do options.backtranslate[v] = k end end if options.backtranslate and getmetatable(options.backtranslate) == nil then setmetatable(options.backtranslate, { __index = function(t, k) if options.translate[k] ~= k then return nil else return k end end }) end --[[ -- Get the argument tables. If we were passed a valid frame object, get the -- frame arguments (fargs) and the parent frame arguments (pargs), depending -- on the options set and on the parent frame's availability. If we weren't -- passed a valid frame object, we are being called from another Lua module -- or from the debug console, so assume that we were passed a table of args -- directly, and assign it to a new variable (luaArgs). --]] local fargs, pargs, luaArgs if type(frame.args) == 'table' and type(frame.getParent) == 'function' then if options.wrappers then --[[ -- The wrappers option makes Module:Arguments look up arguments in -- either the frame argument table or the parent argument table, but -- not both. This means that users can use either the #invoke syntax -- or a wrapper template without the loss of performance associated -- with looking arguments up in both the frame and the parent frame. -- Module:Arguments will look up arguments in the parent frame -- if it finds the parent frame's title in options.wrapper; -- otherwise it will look up arguments in the frame object passed -- to getArgs. --]] local parent = frame:getParent() if not parent then fargs = frame.args else local title = parent:getTitle():gsub('/sandbox$', '') local found = false if matchesTitle(options.wrappers, title) then found = true elseif type(options.wrappers) == 'table' then for _,v in pairs(options.wrappers) do if matchesTitle(v, title) then found = true break end end end -- We test for false specifically here so that nil (the default) acts like true. if found or options.frameOnly == false then pargs = parent.args end if not found or options.parentOnly == false then fargs = frame.args end end else -- options.wrapper isn't set, so check the other options. if not options.parentOnly then fargs = frame.args end if not options.frameOnly then local parent = frame:getParent() pargs = parent and parent.args or nil end end if options.parentFirst then fargs, pargs = pargs, fargs end else luaArgs = frame end -- Set the order of precedence of the argument tables. If the variables are -- nil, nothing will be added to the table, which is how we avoid clashes -- between the frame/parent args and the Lua args. local argTables = {fargs} argTables[#argTables + 1] = pargs argTables[#argTables + 1] = luaArgs --[[ -- Generate the tidyVal function. If it has been specified by the user, we -- use that; if not, we choose one of four functions depending on the -- options chosen. This is so that we don't have to call the options table -- every time the function is called. --]] local tidyVal = options.valueFunc if tidyVal then if type(tidyVal) ~= 'function' then error( "bad value assigned to option 'valueFunc'" .. '(function expected, got ' .. type(tidyVal) .. ')', 2 ) end elseif options.trim ~= false then if options.removeBlanks ~= false then tidyVal = tidyValDefault else tidyVal = tidyValTrimOnly end else if options.removeBlanks ~= false then tidyVal = tidyValRemoveBlanksOnly else tidyVal = tidyValNoChange end end --[[ -- Set up the args, metaArgs and nilArgs tables. args will be the one -- accessed from functions, and metaArgs will hold the actual arguments. Nil -- arguments are memoized in nilArgs, and the metatable connects all of them -- together. --]] local args, metaArgs, nilArgs, metatable = {}, {}, {}, {} setmetatable(args, metatable) local function mergeArgs(tables) --[[ -- Accepts multiple tables as input and merges their keys and values -- into one table. If a value is already present it is not overwritten; -- tables listed earlier have precedence. We are also memoizing nil -- values, which can be overwritten if they are 's' (soft). --]] for _, t in ipairs(tables) do for key, val in pairs(t) do if metaArgs[key] == nil and nilArgs[key] ~= 'h' then local tidiedVal = tidyVal(key, val) if tidiedVal == nil then nilArgs[key] = 's' else metaArgs[key] = tidiedVal end end end end end --[[ -- Define metatable behaviour. Arguments are memoized in the metaArgs table, -- and are only fetched from the argument tables once. Fetching arguments -- from the argument tables is the most resource-intensive step in this -- module, so we try and avoid it where possible. For this reason, nil -- arguments are also memoized, in the nilArgs table. Also, we keep a record -- in the metatable of when pairs and ipairs have been called, so we do not -- run pairs and ipairs on the argument tables more than once. We also do -- not run ipairs on fargs and pargs if pairs has already been run, as all -- the arguments will already have been copied over. --]] metatable.__index = function (t, key) --[[ -- Fetches an argument when the args table is indexed. First we check -- to see if the value is memoized, and if not we try and fetch it from -- the argument tables. When we check memoization, we need to check -- metaArgs before nilArgs, as both can be non-nil at the same time. -- If the argument is not present in metaArgs, we also check whether -- pairs has been run yet. If pairs has already been run, we return nil. -- This is because all the arguments will have already been copied into -- metaArgs by the mergeArgs function, meaning that any other arguments -- must be nil. --]] if type(key) == 'string' then key = options.translate[key] end local val = metaArgs[key] if val ~= nil then return val elseif metatable.donePairs or nilArgs[key] then return nil end for _, argTable in ipairs(argTables) do local argTableVal = tidyVal(key, argTable[key]) if argTableVal ~= nil then metaArgs[key] = argTableVal return argTableVal end end nilArgs[key] = 'h' return nil end metatable.__newindex = function (t, key, val) -- This function is called when a module tries to add a new value to the -- args table, or tries to change an existing value. if type(key) == 'string' then key = options.translate[key] end if options.readOnly then error( 'could not write to argument table key "' .. tostring(key) .. '"; the table is read-only', 2 ) elseif options.noOverwrite and args[key] ~= nil then error( 'could not write to argument table key "' .. tostring(key) .. '"; overwriting existing arguments is not permitted', 2 ) elseif val == nil then --[[ -- If the argument is to be overwritten with nil, we need to erase -- the value in metaArgs, so that __index, __pairs and __ipairs do -- not use a previous existing value, if present; and we also need -- to memoize the nil in nilArgs, so that the value isn't looked -- up in the argument tables if it is accessed again. --]] metaArgs[key] = nil nilArgs[key] = 'h' else metaArgs[key] = val end end local function translatenext(invariant) local k, v = next(invariant.t, invariant.k) invariant.k = k if k == nil then return nil elseif type(k) ~= 'string' or not options.backtranslate then return k, v else local backtranslate = options.backtranslate[k] if backtranslate == nil then -- Skip this one. This is a tail call, so this won't cause stack overflow return translatenext(invariant) else return backtranslate, v end end end metatable.__pairs = function () -- Called when pairs is run on the args table. if not metatable.donePairs then mergeArgs(argTables) metatable.donePairs = true end return translatenext, { t = metaArgs } end local function inext(t, i) -- This uses our __index metamethod local v = t[i + 1] if v ~= nil then return i + 1, v end end metatable.__ipairs = function (t) -- Called when ipairs is run on the args table. return inext, t, 0 end return args end return arguments 3134ecce8429b810d445e29eae115e2ae4c36c53 Module:Yesno 828 20 40 2020-04-01T06:27:55Z wikipedia>MusikAnimal 0 Undid revision 948472533 by [[Special:Contributions/w>Vogone|w>Vogone]] ([[User talk:w>Vogone|talk]]) Scribunto text/plain -- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end f767643e7d12126d020d88d662a3dd057817b9dc 41 40 2023-08-02T22:42:11Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain -- Function allowing for consistent treatment of boolean-like wikitext input. -- It works similarly to the template {{yesno}}. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end end f767643e7d12126d020d88d662a3dd057817b9dc Template:Infobox settlement/densdisp 10 42 85 2020-09-28T06:58:54Z wikipedia>Jonesey95 0 Undid revision 980749675 by [[Special:Contributions/Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]). broken wikitext text/x-wiki <includeonly>{{#if: {{#iferror:{{#expr:-{{formatnum:{{{/km2}}}|R}}}} |{{#iferror:{{#expr:-{{formatnum:{{{/sqmi}}}|R}}}} |{{#switch:auto |{{{/km2}}}|{{{/sqmi}}}={{#iferror:{{#expr:-{{formatnum:{{{pop}}}|R}}}} ||{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{ha|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{km2|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{acre|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{sqmi|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{dunam|}}}|R}}}}}} +0 >0 |1}} }} }} |1 }} |1 }} |{{infobox settlement/{{infobox settlement/pref|{{{pref}}}|{{{name}}}}} |metv={{#iferror:{{#expr:-{{formatnum:{{{/km2}}}|R}}}} |{{#iferror:{{#expr:-{{formatnum:{{{/sqmi}}}|R}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{km2|}}}|R}}}}}}+0>0 |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{ha|}}}|R}}}}}}+0>0 |{{round|{{#expr:100*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:100*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{dunam|}}}|R}}}}}}+0>0 |{{round|{{#expr:1000*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:1000*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{sqmi|}}}|R}}}}}}+0>0 |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}/2.589988110336}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}/2.589988110336}}}}}}}} |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}/0.004046856422}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}/0.004046856422}}}}}}}} }}}}}}}} |{{round |{{#expr:{{formatnum:{{{/sqmi}}}|R}}/2.589988110336}} |{{max |{{precision|{{formatnum:{{{/sqmi}}}|R}}}} |-{{Order of magnitude|{{#expr:{{formatnum:{{{/sqmi}}}|R}}/2.589988110336}}}} }} }} }} |{{{/km2}}} }} |metu=km<sup>2</sup> |impv={{#iferror:{{#expr:-{{formatnum:{{{/sqmi}}}|R}}}} |{{#iferror:{{#expr:-{{formatnum:{{{/km2}}}|R}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{sqmi|}}}|R}}}}}}+0>0 |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{acre|}}}|R}}}}}}+0>0 |{{round|{{#expr:640*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:640*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{km2|}}}|R}}}}}}+0>0 |{{round|{{#expr:2.589988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:2.589988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{ha|}}}|R}}}}}}+0>0 |{{round|{{#expr:258.9988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:258.9988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}}}}}}} |{{round|{{#expr:2589.988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:2589.988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}}}}}}} }}}}}}}} |{{round |{{#expr:{{formatnum:{{{/km2}}}|R}}*2.589988110336}} |{{max |{{#expr:{{precision|{{formatnum:{{{/km2}}}|R}}}}-1}} |-{{Order of magnitude|{{#expr:{{formatnum:{{{/km2}}}|R}}*2.589988110336}}}} }} }} }} |{{{/sqmi}}} }} |impu=sq&nbsp;mi |s=/ }} }}</includeonly><noinclude> {{documentation}} </noinclude> 8d2587f8008e5720272fd3abbbdd54f8c8dc306a Module:Check for clobbered parameters 828 43 87 2021-05-07T15:16:54Z wikipedia>Izno 0 use if preview Scribunto text/plain local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end function p.check(frame) local args = frame.args local pargs = frame:getParent().args local checknested = isnotempty(args['nested']) local delimiter = isnotempty(args['delimiter']) and args['delimiter'] or ';' local argpairs = {} for k, v in pairs(args) do if type(k) == 'number' then local plist = mw.text.split(v, delimiter) local pfound = {} local count = 0 for ii, vv in ipairs(plist) do vv = trim(vv) if checknested and pargs[vv] or isnotempty(pargs[vv]) then count = count + 1 table.insert(pfound, vv) end end if count > 1 then table.insert(argpairs, pfound) end end end local warnmsg = {} local res = '' local cat = '' if args['cat'] and mw.ustring.match(args['cat'],'^[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]:') then cat = args['cat'] end local template = args['template'] and ' in ' .. args['template'] or '' if #argpairs > 0 then for i, v in ipairs( argpairs ) do table.insert( warnmsg, mw.ustring.format( 'Using more than one of the following parameters%s: <code>%s</code>.', template, table.concat(v, '</code>, <code>') ) ) if cat ~= '' then res = res .. '[[' .. cat .. '|' .. (v[1] == '' and ' ' or '') .. v[1] .. ']]' end end end if #warnmsg > 0 then res = require('Module:If preview')._warning({ table.concat(warnmsg, '<br>') }) .. res end return res end return p 2d18fb6802fa261d88a0e135ab147ab9f062acde Template:Infobox settlement/columns 10 37 75 2021-06-14T22:57:30Z wikipedia>Izno 0 templatestyles wikitext text/x-wiki <templatestyles src="Infobox settlement/columns/styles.css"/> <div class="ib-settlement-cols"> <div class="ib-settlement-cols-row">{{#if:{{{0|}}} |<!-- if 0 -->{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}} |<!-- if 0 and (1 or 2 or 3 or 4 or 5) --><div class="ib-settlement-cols-cellt"> {{#if:{{{1|}}}|<div>{{{1}}}</div>}} {{#if:{{{2|}}}|<div>{{{2}}}</div>}} {{#if:{{{3|}}}|<div>{{{3}}}</div>}} {{#if:{{{4|}}}|<div>{{{4}}}</div>}} {{#if:{{{5|}}}|<div>{{{5}}}</div>}} </div> }}<div class="ib-settlement-cols-cellt">{{{0}}}</div> |<!-- if not 0 -->{{#ifexpr:({{#if:{{{1|}}}|1|0}}+{{#if:{{{2|}}}|1|0}}+{{#if:{{{3|}}}|1|0}}+{{#if:{{{4|}}}|1|0}}) > 2 |<!-- if more than two images -->{{#if:{{{1|}}} |<div class="ib-settlement-cols-cell">{{{1}}}</div>{{#if:{{{2|}}}||</div></div><div class="ib-settlement-cols"><!-- TODO: The "3" element case currently produces two div-tables, which is non-optimal, but someone else should figure out how to fix it; 4 and 2 cases output as one "table". --><div class="ib-settlement-cols-row">}} }}{{#if:{{{2|}}} |<div class="ib-settlement-cols-cell">{{{2}}}</div>{{#if:{{{1|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}} }}</div><div class="ib-settlement-cols-row">{{#if:{{{3|}}} |{{#if:{{{4|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{3}}}</div> }}{{#if:{{{4|}}} |{{#if:{{{3|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{4}}}</div> }} |<!-- if two or fewer images -->{{#if:{{{1|}}}|<div class="ib-settlement-cols-cell">{{{1}}}</div>}}<!-- -->{{#if:{{{2|}}}|<div class="ib-settlement-cols-cell">{{{2}}}</div>}}<!-- -->{{#if:{{{3|}}}|<div class="ib-settlement-cols-cell">{{{3}}}</div>}}<!-- -->{{#if:{{{4|}}}|<div class="ib-settlement-cols-cell">{{{4}}}</div>}} }} }}</div></div><noinclude> {{documentation}} </noinclude> bdd926fcf77e5f0f9f899ac6b2e23cd7efc8584e Template:Infobox settlement/styles.css 10 36 73 2021-09-08T20:43:54Z wikipedia>Izno 0 fix .maptable line text text/plain /* {{pp|small=y}} */ .ib-settlement { width: 23em; border-collapse: collapse; line-height: 1.2em; } /* TODO split definitions to appropriate class names when live from HTML element */ .ib-settlement td, .ib-settlement th { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.4em 0.6em; } .ib-settlement .mergedtoprow .infobox-full-data, .ib-settlement .mergedtoprow .infobox-header, .ib-settlement .mergedtoprow .infobox-data, .ib-settlement .mergedtoprow .infobox-label, .ib-settlement .mergedtoprow .infobox-below { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.2em 0.6em; } .ib-settlement .mergedrow .infobox-full-data, .ib-settlement .mergedrow .infobox-data, .ib-settlement .mergedrow .infobox-label { border: 0; padding: 0 0.6em 0.2em 0.6em; } .ib-settlement .mergedbottomrow .infobox-full-data, .ib-settlement .mergedbottomrow .infobox-data, .ib-settlement .mergedbottomrow .infobox-label { border-top: 0; border-bottom: 1px solid #a2a9b1; padding: 0 0.6em 0.4em 0.6em; } .ib-settlement .maptable { border: 0; padding: 0; } .ib-settlement .infobox-header, .ib-settlement .infobox-below { text-align: left; } .ib-settlement .infobox-above { font-size: 125%; line-height: 1.3em; } .ib-settlement .infobox-subheader { background-color: #cddeff; font-weight: bold; } .ib-settlement-native { font-weight: normal; padding-top: 0.2em; } .ib-settlement-other-name { font-size: 78%; } .ib-settlement-official { font-weight: bold; } .ib-settlement-caption { padding: 0.3em 0 0 0; } .ib-settlement-caption-link { padding: 0.2em 0; } .ib-settlement-nickname { display: inline; } .ib-settlement-fn { font-weight: normal; display: inline; } bcad428737f5a62eb7bced25a38fccbd46dde186 Module:Unsubst 828 15 30 2021-10-08T18:22:16Z wikipedia>Trappist the monk 0 sync from sandbox; see [[Module_talk:Unsubst#template_invocation_name_override|talk]]; Scribunto text/plain local checkType = require('libraryUtil').checkType local p = {} local BODY_PARAM = '$B' local specialParams = { ['$params'] = 'parameter list', ['$aliases'] = 'parameter aliases', ['$flags'] = 'flags', ['$B'] = 'template content', ['$template-name'] = 'template invocation name override', } function p.main(frame, body) -- If we are substing, this function returns a template invocation, and if -- not, it returns the template body. The template body can be specified in -- the body parameter, or in the template parameter defined in the -- BODY_PARAM variable. This function can be called from Lua or from -- #invoke. -- Return the template body if we aren't substing. if not mw.isSubsting() then if body ~= nil then return body elseif frame.args[BODY_PARAM] ~= nil then return frame.args[BODY_PARAM] else error(string.format( "no template content specified (use parameter '%s' from #invoke)", BODY_PARAM ), 2) end end -- Sanity check for the frame object. if type(frame) ~= 'table' or type(frame.getParent) ~= 'function' or not frame:getParent() then error( "argument #1 to 'main' must be a frame object with a parent " .. "frame available", 2 ) end -- Find the invocation name. local mTemplateInvocation = require('Module:Template invocation') local name if frame.args['$template-name'] and '' ~= frame.args['$template-name'] then name = frame.args['$template-name'] -- override whatever the template name is with this name else name = mTemplateInvocation.name(frame:getParent():getTitle()) end -- Combine passed args with passed defaults local args = {} if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then for k, v in pairs( frame:getParent().args ) do args[k] = v end for k, v in pairs( frame.args ) do if not specialParams[k] then if v == '__DATE__' then v = mw.getContentLanguage():formatDate( 'F Y' ) end args[k] = v end end else for k, v in pairs( frame.args ) do if not specialParams[k] then if v == '__DATE__' then v = mw.getContentLanguage():formatDate( 'F Y' ) end args[k] = v end end for k, v in pairs( frame:getParent().args ) do args[k] = v end end -- Trim parameters, if not specified otherwise if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '^%s*(.*)%s*$') or '' end end -- Pull information from parameter aliases local aliases = {} if frame.args['$aliases'] then local list = mw.text.split( frame.args['$aliases'], '%s*,%s*' ) for k, v in ipairs( list ) do local tmp = mw.text.split( v, '%s*>%s*' ) aliases[tonumber(mw.ustring.match(tmp[1], '^[1-9][0-9]*$')) or tmp[1]] = ((tonumber(mw.ustring.match(tmp[2], '^[1-9][0-9]*$'))) or tmp[2]) end end for k, v in pairs( aliases ) do if args[k] and ( not args[v] or args[v] == '' ) then args[v] = args[k] end args[k] = nil end -- Remove empty parameters, if specified if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*remove%-empty%s*,' ) then local tmp = 0 for k, v in ipairs( args ) do if v ~= '' or ( args[k+1] and args[k+1] ~= '' ) or ( args[k+2] and args[k+2] ~= '' ) then tmp = k else break end end for k, v in pairs( args ) do if v == '' then if not (type(k) == 'number' and k < tmp) then args[k] = nil end end end end -- Order parameters if frame.args['$params'] then local params, tmp = mw.text.split( frame.args['$params'], '%s*,%s*' ), {} for k, v in ipairs(params) do v = tonumber(mw.ustring.match(v, '^[1-9][0-9]*$')) or v if args[v] then tmp[v], args[v] = args[v], nil end end for k, v in pairs(args) do tmp[k], args[k] = args[k], nil end args = tmp end return mTemplateInvocation.invocation(name, args) end p[''] = p.main -- For backwards compatibility return p 7f01ffc8aa2ac4a4772f14c12e0b77e384ecabb6 31 30 2023-08-02T22:42:09Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain local checkType = require('libraryUtil').checkType local p = {} local BODY_PARAM = '$B' local specialParams = { ['$params'] = 'parameter list', ['$aliases'] = 'parameter aliases', ['$flags'] = 'flags', ['$B'] = 'template content', ['$template-name'] = 'template invocation name override', } function p.main(frame, body) -- If we are substing, this function returns a template invocation, and if -- not, it returns the template body. The template body can be specified in -- the body parameter, or in the template parameter defined in the -- BODY_PARAM variable. This function can be called from Lua or from -- #invoke. -- Return the template body if we aren't substing. if not mw.isSubsting() then if body ~= nil then return body elseif frame.args[BODY_PARAM] ~= nil then return frame.args[BODY_PARAM] else error(string.format( "no template content specified (use parameter '%s' from #invoke)", BODY_PARAM ), 2) end end -- Sanity check for the frame object. if type(frame) ~= 'table' or type(frame.getParent) ~= 'function' or not frame:getParent() then error( "argument #1 to 'main' must be a frame object with a parent " .. "frame available", 2 ) end -- Find the invocation name. local mTemplateInvocation = require('Module:Template invocation') local name if frame.args['$template-name'] and '' ~= frame.args['$template-name'] then name = frame.args['$template-name'] -- override whatever the template name is with this name else name = mTemplateInvocation.name(frame:getParent():getTitle()) end -- Combine passed args with passed defaults local args = {} if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*override%s*,' ) then for k, v in pairs( frame:getParent().args ) do args[k] = v end for k, v in pairs( frame.args ) do if not specialParams[k] then if v == '__DATE__' then v = mw.getContentLanguage():formatDate( 'F Y' ) end args[k] = v end end else for k, v in pairs( frame.args ) do if not specialParams[k] then if v == '__DATE__' then v = mw.getContentLanguage():formatDate( 'F Y' ) end args[k] = v end end for k, v in pairs( frame:getParent().args ) do args[k] = v end end -- Trim parameters, if not specified otherwise if not string.find( ','..(frame.args['$flags'] or '')..',', ',%s*keep%-whitespace%s*,' ) then for k, v in pairs( args ) do args[k] = mw.ustring.match(v, '^%s*(.*)%s*$') or '' end end -- Pull information from parameter aliases local aliases = {} if frame.args['$aliases'] then local list = mw.text.split( frame.args['$aliases'], '%s*,%s*' ) for k, v in ipairs( list ) do local tmp = mw.text.split( v, '%s*>%s*' ) aliases[tonumber(mw.ustring.match(tmp[1], '^[1-9][0-9]*$')) or tmp[1]] = ((tonumber(mw.ustring.match(tmp[2], '^[1-9][0-9]*$'))) or tmp[2]) end end for k, v in pairs( aliases ) do if args[k] and ( not args[v] or args[v] == '' ) then args[v] = args[k] end args[k] = nil end -- Remove empty parameters, if specified if string.find( ','..(frame.args['$flags'] or '')..',', ',%s*remove%-empty%s*,' ) then local tmp = 0 for k, v in ipairs( args ) do if v ~= '' or ( args[k+1] and args[k+1] ~= '' ) or ( args[k+2] and args[k+2] ~= '' ) then tmp = k else break end end for k, v in pairs( args ) do if v == '' then if not (type(k) == 'number' and k < tmp) then args[k] = nil end end end end -- Order parameters if frame.args['$params'] then local params, tmp = mw.text.split( frame.args['$params'], '%s*,%s*' ), {} for k, v in ipairs(params) do v = tonumber(mw.ustring.match(v, '^[1-9][0-9]*$')) or v if args[v] then tmp[v], args[v] = args[v], nil end end for k, v in pairs(args) do tmp[k], args[k] = args[k], nil end args = tmp end return mTemplateInvocation.invocation(name, args) end p[''] = p.main -- For backwards compatibility return p 7f01ffc8aa2ac4a4772f14c12e0b77e384ecabb6 Template:Main other 10 39 79 2021-12-10T16:08:06Z wikipedia>Xaosflux 0 <!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! --> wikitext text/x-wiki {{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:0}} | main | other }} }} | main = {{{1|}}} | other | #default = {{{2|}}} }}<noinclude> {{documentation}} <!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! --> </noinclude> 86ad907ffeea3cc545159e00cd1f2d6433946450 Module:Infobox/styles.css 828 34 69 2022-01-18T15:18:00Z wikipedia>Jdlrobson 0 Fix [[phab:T281642]], a pet peeve of mine. This copies across styles from [[MediaWiki:Minerva.css]] text text/plain /* {{pp|small=y}} */ /* * This TemplateStyles sheet deliberately does NOT include the full set of * infobox styles. We are still working to migrate all of the manual * infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]] * DO NOT ADD THEM HERE */ /* * not strictly certain these styles are necessary since the modules now * exclusively output infobox-subbox or infobox, not both * just replicating the module faithfully */ .infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; } .infobox-3cols-child { margin: auto; } .infobox .navbar { font-size: 100%; } /* T281642 */ body.skin-minerva .infobox-header, body.skin-minerva .infobox-subheader, body.skin-minerva .infobox-above, body.skin-minerva .infobox-title, body.skin-minerva .infobox-image, body.skin-minerva .infobox-full-data, body.skin-minerva .infobox-below { text-align: center; } e8de6d96f4fde53afc4a6b0fed534405ab59b0a7 Module:Check for unknown parameters 828 25 50 2022-02-21T05:24:13Z wikipedia>BusterD 0 Changed protection settings for "[[Module:Check for unknown parameters]]": [[WP:High-risk templates|Highly visible template]]; requested at [[WP:RfPP]] ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) Scribunto text/plain -- This module may be used to compare the arguments passed to the parent -- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return '' end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end -- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end -- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(tostring(k), regexp) then knownflag = true break end end if not knownflag and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end end -- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, ' if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == '' then v = ' ' end -- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end return table.concat(res) end function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end return p 93db6d115d4328d2a5148bb42959105e367b663e Module:InfoboxImage 828 24 48 2022-03-13T19:18:18Z wikipedia>WOSlinker 0 add class param from sandbox as per edit request Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Female no free image yet.png", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female (blue).svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then return ""; end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = "[[Category:Pages using infoboxes with thumbnail images]]"; end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,5) == mw.ustring.char(127).."UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; elseif mw.ustring.sub(image,4,9) == "`UNIQ-" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 0ee5fe75ba239fc5c9cedc81ca11bdc0be068542 Template:If empty 10 38 77 2022-04-03T20:56:41Z wikipedia>Wugapodes 0 Changed protection settings for "[[Template:If empty]]": [[WP:High-risk templates|Highly visible template]]: used on 2 million pages and permanently cascade protected; matches module protection ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite)) wikitext text/x-wiki {{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}<noinclude>{{Documentation}}</noinclude> 745940b7bdde8a1585c887ee4ee5ce81d98461a4 Module:Hatnote 828 14 28 2022-09-05T18:18:32Z wikipedia>Nihiltres 0 Reordered helper functions (first by export status, then alphabetically) and migrated p.quote upstream from [[Module:Redirect hatnote]] (includes contributions by Tamzin and Nihiltres) Scribunto text/plain -------------------------------------------------------------------------------- -- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the {{hatnote}} and {{format link}} meta-templates and includes -- -- helper functions for other Lua hatnote modules. -- -------------------------------------------------------------------------------- local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise [[Module:Arguments]] local yesno -- lazily initialise [[Module:Yesno]] local formatLink -- lazily initialise [[Module:Format link]] ._formatLink local p = {} -------------------------------------------------------------------------------- -- Helper functions -------------------------------------------------------------------------------- local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end function p.defaultClasses(inline) -- Provides the default hatnote classes as a space-separated string; useful -- for hatnote-manipulation modules like [[Module:Hatnote group]]. return (inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' .. 'navigation-not-searchable' end function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return mw.ustring.format('%s (%s)', page, disambiguator) end function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- [[Module:Yesno]], and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' ([[' .. helpLink .. '|help]])' else helpText = '' end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = mw.ustring.format( '[[%s:%s]]', mw.site.namespaces[14].name, category ) else category = '' end return mw.ustring.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end local curNs = mw.title.getCurrentTitle().namespace p.missingTargetCat = --Default missing target category, exported for use in related modules ((curNs == 0) or (curNs == 14)) and 'Articles with hatnote templates targeting a nonexistent page' or nil function p.quote(title) --Wraps titles in quotation marks. If the title starts/ends with a quotation --mark, kerns that side as with {{-'}} local quotationMarks = { ["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true } local quoteLeft, quoteRight = -- Test if start/end are quotation marks quotationMarks[string.sub(title, 1, 1)], quotationMarks[string.sub(title, -1, -1)] if quoteLeft or quoteRight then title = mw.html.create("span"):wikitext(title) end if quoteLeft then title:css("padding-left", "0.15em") end if quoteRight then title:css("padding-right", "0.15em") end return '"' .. tostring(title) .. '"' end -------------------------------------------------------------------------------- -- Hatnote -- -- Produces standard hatnote text. Implements the {{hatnote}} template. -------------------------------------------------------------------------------- function p.hatnote(frame) local args = getArgs(frame) local s = args[1] if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end return p._hatnote(s, { extraclasses = args.extraclasses, selfref = args.selfref }) end function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local inline = options.inline local hatnote = mw.html.create(inline == 1 and 'span' or 'div') local extraclasses if type(options.extraclasses) == 'string' then extraclasses = options.extraclasses end hatnote :attr('role', 'note') :addClass(p.defaultClasses(inline)) :addClass(extraclasses) :addClass(options.selfref and 'selfref' or nil) :wikitext(s) return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } } .. tostring(hatnote) end return p 3ae1ed7094c5005ca0896395ec9a587287a0bef1 29 28 2023-08-02T22:42:09Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain -------------------------------------------------------------------------------- -- Module:Hatnote -- -- -- -- This module produces hatnote links and links to related articles. It -- -- implements the {{hatnote}} and {{format link}} meta-templates and includes -- -- helper functions for other Lua hatnote modules. -- -------------------------------------------------------------------------------- local libraryUtil = require('libraryUtil') local checkType = libraryUtil.checkType local checkTypeForNamedArg = libraryUtil.checkTypeForNamedArg local mArguments -- lazily initialise [[Module:Arguments]] local yesno -- lazily initialise [[Module:Yesno]] local formatLink -- lazily initialise [[Module:Format link]] ._formatLink local p = {} -------------------------------------------------------------------------------- -- Helper functions -------------------------------------------------------------------------------- local function getArgs(frame) -- Fetches the arguments from the parent frame. Whitespace is trimmed and -- blanks are removed. mArguments = require('Module:Arguments') return mArguments.getArgs(frame, {parentOnly = true}) end local function removeInitialColon(s) -- Removes the initial colon from a string, if present. return s:match('^:?(.*)') end function p.defaultClasses(inline) -- Provides the default hatnote classes as a space-separated string; useful -- for hatnote-manipulation modules like [[Module:Hatnote group]]. return (inline == 1 and 'hatnote-inline' or 'hatnote') .. ' ' .. 'navigation-not-searchable' end function p.disambiguate(page, disambiguator) -- Formats a page title with a disambiguation parenthetical, -- i.e. "Example" → "Example (disambiguation)". checkType('disambiguate', 1, page, 'string') checkType('disambiguate', 2, disambiguator, 'string', true) disambiguator = disambiguator or 'disambiguation' return mw.ustring.format('%s (%s)', page, disambiguator) end function p.findNamespaceId(link, removeColon) -- Finds the namespace id (namespace number) of a link or a pagename. This -- function will not work if the link is enclosed in double brackets. Colons -- are trimmed from the start of the link by default. To skip colon -- trimming, set the removeColon parameter to false. checkType('findNamespaceId', 1, link, 'string') checkType('findNamespaceId', 2, removeColon, 'boolean', true) if removeColon ~= false then link = removeInitialColon(link) end local namespace = link:match('^(.-):') if namespace then local nsTable = mw.site.namespaces[namespace] if nsTable then return nsTable.id end end return 0 end function p.makeWikitextError(msg, helpLink, addTrackingCategory, title) -- Formats an error message to be returned to wikitext. If -- addTrackingCategory is not false after being returned from -- [[Module:Yesno]], and if we are not on a talk page, a tracking category -- is added. checkType('makeWikitextError', 1, msg, 'string') checkType('makeWikitextError', 2, helpLink, 'string', true) yesno = require('Module:Yesno') title = title or mw.title.getCurrentTitle() -- Make the help link text. local helpText if helpLink then helpText = ' ([[' .. helpLink .. '|help]])' else helpText = '' end -- Make the category text. local category if not title.isTalkPage -- Don't categorise talk pages and title.namespace ~= 2 -- Don't categorise userspace and yesno(addTrackingCategory) ~= false -- Allow opting out then category = 'Hatnote templates with errors' category = mw.ustring.format( '[[%s:%s]]', mw.site.namespaces[14].name, category ) else category = '' end return mw.ustring.format( '<strong class="error">Error: %s%s.</strong>%s', msg, helpText, category ) end local curNs = mw.title.getCurrentTitle().namespace p.missingTargetCat = --Default missing target category, exported for use in related modules ((curNs == 0) or (curNs == 14)) and 'Articles with hatnote templates targeting a nonexistent page' or nil function p.quote(title) --Wraps titles in quotation marks. If the title starts/ends with a quotation --mark, kerns that side as with {{-'}} local quotationMarks = { ["'"]=true, ['"']=true, ['“']=true, ["‘"]=true, ['”']=true, ["’"]=true } local quoteLeft, quoteRight = -- Test if start/end are quotation marks quotationMarks[string.sub(title, 1, 1)], quotationMarks[string.sub(title, -1, -1)] if quoteLeft or quoteRight then title = mw.html.create("span"):wikitext(title) end if quoteLeft then title:css("padding-left", "0.15em") end if quoteRight then title:css("padding-right", "0.15em") end return '"' .. tostring(title) .. '"' end -------------------------------------------------------------------------------- -- Hatnote -- -- Produces standard hatnote text. Implements the {{hatnote}} template. -------------------------------------------------------------------------------- function p.hatnote(frame) local args = getArgs(frame) local s = args[1] if not s then return p.makeWikitextError( 'no text specified', 'Template:Hatnote#Errors', args.category ) end return p._hatnote(s, { extraclasses = args.extraclasses, selfref = args.selfref }) end function p._hatnote(s, options) checkType('_hatnote', 1, s, 'string') checkType('_hatnote', 2, options, 'table', true) options = options or {} local inline = options.inline local hatnote = mw.html.create(inline == 1 and 'span' or 'div') local extraclasses if type(options.extraclasses) == 'string' then extraclasses = options.extraclasses end hatnote :attr('role', 'note') :addClass(p.defaultClasses(inline)) :addClass(extraclasses) :addClass(options.selfref and 'selfref' or nil) :wikitext(s) return mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:Hatnote/styles.css' } } .. tostring(hatnote) end return p 3ae1ed7094c5005ca0896395ec9a587287a0bef1 Module:Message box 828 17 34 2022-10-23T04:26:44Z wikipedia>Legoktm 0 Replace [[Module:No globals]] with require( "strict" ) Scribunto text/plain require('strict') local getArgs local yesno = require('Module:Yesno') local lang = mw.language.getContentLanguage() local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'} -------------------------------------------------------------------------------- -- Helper functions -------------------------------------------------------------------------------- local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -------------------------------------------------------------------------------- -- Box class definition -------------------------------------------------------------------------------- local MessageBox = {} MessageBox.__index = MessageBox function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {} -- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle() -- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= '' then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end -- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= '' then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end -- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of [[Module:Category handler]]. obj.hasCategories = false return setmetatable(obj, MessageBox) end function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format('[[Category:%s|%s]]', cat, sort) else cat = string.format('[[Category:%s]]', cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end function MessageBox:setParameters() local args = self.args local cfg = self.cfg -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image -- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST' -- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) ) -- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs -- Set text style. self.textstyle = args.textstyle -- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end -- Process data for collapsible text fields. At the moment these are only -- used in {{ambox}}. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == '' then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= '' and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end -- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == '' and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == '' then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText if self.isSmall then local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk) talkText = string.format('([[%s|talk]])', talkLink) else talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s [[%s|%s]].', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the [[%s#%s|talk page]].', talkText, talkTitle.prefixedText, talk ) end end self.talk = talkText end end -- Get other values. self.fix = args.fix ~= '' and args.fix or nil local date if args.date and args.date ~= '' then date = args.date elseif args.date == '' and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end -- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end -- Set the below row. self.below = cfg.below and args.below -- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell -- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage or 'Imbox notice.png', imageSize) end end -- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end -- set templatestyles self.base_templatestyles = cfg.templatestyles self.templatestyles = args.templatestyles end function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg if not cfg.allowMainspaceCategories then return nil end local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end -- The following is roughly equivalent to the old {{Ambox/category}}. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= '' then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == '') then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg -- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end -- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- [[Module:Category handler]]. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end function MessageBox:export() local root = mw.html.create() -- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.', mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}') )) end local frame = mw.getCurrentFrame() root:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = self.base_templatestyles }, }) -- Add support for a single custom templatestyles sheet. Undocumented as -- need should be limited and many templates using mbox are substed; we -- don't want to spread templatestyles sheets around to arbitrary places if self.templatestyles then root:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = self.templatestyles }, }) end -- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation') if self.attrs then boxTable:attr(self.attrs) end -- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') end -- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('span') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end -- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div') end imageRightCell :wikitext(self.imageRight or nil) end -- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end -- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :addClass('mbox-invalid-type') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or '' )) end -- Add categories. root:wikitext(self:renderCategories() or nil) return tostring(root) end -------------------------------------------------------------------------------- -- Exports -------------------------------------------------------------------------------- local p, mt = {}, {} function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end return setmetatable(p, mt) bdb0ecc9f26f26b9c0ce12a066a183ac9d4f0705 35 34 2023-08-02T22:42:10Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain require('strict') local getArgs local yesno = require('Module:Yesno') local lang = mw.language.getContentLanguage() local CONFIG_MODULE = 'Module:Message box/configuration' local DEMOSPACES = {talk = 'tmbox', image = 'imbox', file = 'imbox', category = 'cmbox', article = 'ambox', main = 'ambox'} -------------------------------------------------------------------------------- -- Helper functions -------------------------------------------------------------------------------- local function getTitleObject(...) -- Get the title object, passing the function through pcall -- in case we are over the expensive function count limit. local success, title = pcall(mw.title.new, ...) if success then return title end end local function union(t1, t2) -- Returns the union of two arrays. local vals = {} for i, v in ipairs(t1) do vals[v] = true end for i, v in ipairs(t2) do vals[v] = true end local ret = {} for k in pairs(vals) do table.insert(ret, k) end table.sort(ret) return ret end local function getArgNums(args, prefix) local nums = {} for k, v in pairs(args) do local num = mw.ustring.match(tostring(k), '^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -------------------------------------------------------------------------------- -- Box class definition -------------------------------------------------------------------------------- local MessageBox = {} MessageBox.__index = MessageBox function MessageBox.new(boxType, args, cfg) args = args or {} local obj = {} -- Set the title object and the namespace. obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle() -- Set the config for our box type. obj.cfg = cfg[boxType] if not obj.cfg then local ns = obj.title.namespace -- boxType is "mbox" or invalid input if args.demospace and args.demospace ~= '' then -- implement demospace parameter of mbox local demospace = string.lower(args.demospace) if DEMOSPACES[demospace] then -- use template from DEMOSPACES obj.cfg = cfg[DEMOSPACES[demospace]] elseif string.find( demospace, 'talk' ) then -- demo as a talk page obj.cfg = cfg.tmbox else -- default to ombox obj.cfg = cfg.ombox end elseif ns == 0 then obj.cfg = cfg.ambox -- main namespace elseif ns == 6 then obj.cfg = cfg.imbox -- file namespace elseif ns == 14 then obj.cfg = cfg.cmbox -- category namespace else local nsTable = mw.site.namespaces[ns] if nsTable and nsTable.isTalk then obj.cfg = cfg.tmbox -- any talk namespace else obj.cfg = cfg.ombox -- other namespaces or invalid input end end end -- Set the arguments, and remove all blank arguments except for the ones -- listed in cfg.allowBlankParams. do local newArgs = {} for k, v in pairs(args) do if v ~= '' then newArgs[k] = v end end for i, param in ipairs(obj.cfg.allowBlankParams or {}) do newArgs[param] = args[param] end obj.args = newArgs end -- Define internal data structure. obj.categories = {} obj.classes = {} -- For lazy loading of [[Module:Category handler]]. obj.hasCategories = false return setmetatable(obj, MessageBox) end function MessageBox:addCat(ns, cat, sort) if not cat then return nil end if sort then cat = string.format('[[Category:%s|%s]]', cat, sort) else cat = string.format('[[Category:%s]]', cat) end self.hasCategories = true self.categories[ns] = self.categories[ns] or {} table.insert(self.categories[ns], cat) end function MessageBox:addClass(class) if not class then return nil end table.insert(self.classes, class) end function MessageBox:setParameters() local args = self.args local cfg = self.cfg -- Get type data. self.type = args.type local typeData = cfg.types[self.type] self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData typeData = typeData or cfg.types[cfg.default] self.typeClass = typeData.class self.typeImage = typeData.image -- Find if the box has been wrongly substituted. self.isSubstituted = cfg.substCheck and args.subst == 'SUBST' -- Find whether we are using a small message box. self.isSmall = cfg.allowSmall and ( cfg.smallParam and args.small == cfg.smallParam or not cfg.smallParam and yesno(args.small) ) -- Add attributes, classes and styles. self.id = args.id self.name = args.name if self.name then self:addClass('box-' .. string.gsub(self.name,' ','_')) end if yesno(args.plainlinks) ~= false then self:addClass('plainlinks') end for _, class in ipairs(cfg.classes or {}) do self:addClass(class) end if self.isSmall then self:addClass(cfg.smallClass or 'mbox-small') end self:addClass(self.typeClass) self:addClass(args.class) self.style = args.style self.attrs = args.attrs -- Set text style. self.textstyle = args.textstyle -- Find if we are on the template page or not. This functionality is only -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory -- and cfg.templateCategoryRequireName are set. self.useCollapsibleTextFields = cfg.useCollapsibleTextFields if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then if self.name then local templateName = mw.ustring.match( self.name, '^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$' ) or self.name templateName = 'Template:' .. templateName self.templateTitle = getTitleObject(templateName) end self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) end -- Process data for collapsible text fields. At the moment these are only -- used in {{ambox}}. if self.useCollapsibleTextFields then -- Get the self.issue value. if self.isSmall and args.smalltext then self.issue = args.smalltext else local sect if args.sect == '' then sect = 'This ' .. (cfg.sectionDefault or 'page') elseif type(args.sect) == 'string' then sect = 'This ' .. args.sect end local issue = args.issue issue = type(issue) == 'string' and issue ~= '' and issue or nil local text = args.text text = type(text) == 'string' and text or nil local issues = {} table.insert(issues, sect) table.insert(issues, issue) table.insert(issues, text) self.issue = table.concat(issues, ' ') end -- Get the self.talk value. local talk = args.talk -- Show talk links on the template page or template subpages if the talk -- parameter is blank. if talk == '' and self.templateTitle and ( mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle) ) then talk = '#' elseif talk == '' then talk = nil end if talk then -- If the talk value is a talk page, make a link to that page. Else -- assume that it's a section heading, and make a link to the talk -- page of the current page with that section heading. local talkTitle = getTitleObject(talk) local talkArgIsTalkPage = true if not talkTitle or not talkTitle.isTalkPage then talkArgIsTalkPage = false talkTitle = getTitleObject( self.title.text, mw.site.namespaces[self.title.namespace].talk.id ) end if talkTitle and talkTitle.exists then local talkText if self.isSmall then local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk) talkText = string.format('([[%s|talk]])', talkLink) else talkText = 'Relevant discussion may be found on' if talkArgIsTalkPage then talkText = string.format( '%s [[%s|%s]].', talkText, talk, talkTitle.prefixedText ) else talkText = string.format( '%s the [[%s#%s|talk page]].', talkText, talkTitle.prefixedText, talk ) end end self.talk = talkText end end -- Get other values. self.fix = args.fix ~= '' and args.fix or nil local date if args.date and args.date ~= '' then date = args.date elseif args.date == '' and self.isTemplatePage then date = lang:formatDate('F Y') end if date then self.date = string.format(" <span class='date-container'><i>(<span class='date'>%s</span>)</i></span>", date) end self.info = args.info if yesno(args.removalnotice) then self.removalNotice = cfg.removalNotice end end -- Set the non-collapsible text field. At the moment this is used by all box -- types other than ambox, and also by ambox when small=yes. if self.isSmall then self.text = args.smalltext or args.text else self.text = args.text end -- Set the below row. self.below = cfg.below and args.below -- General image settings. self.imageCellDiv = not self.isSmall and cfg.imageCellDiv self.imageEmptyCell = cfg.imageEmptyCell -- Left image settings. local imageLeft = self.isSmall and args.smallimage or args.image if cfg.imageCheckBlank and imageLeft ~= 'blank' and imageLeft ~= 'none' or not cfg.imageCheckBlank and imageLeft ~= 'none' then self.imageLeft = imageLeft if not imageLeft then local imageSize = self.isSmall and (cfg.imageSmallSize or '30x30px') or '40x40px' self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage or 'Imbox notice.png', imageSize) end end -- Right image settings. local imageRight = self.isSmall and args.smallimageright or args.imageright if not (cfg.imageRightNone and imageRight == 'none') then self.imageRight = imageRight end -- set templatestyles self.base_templatestyles = cfg.templatestyles self.templatestyles = args.templatestyles end function MessageBox:setMainspaceCategories() local args = self.args local cfg = self.cfg if not cfg.allowMainspaceCategories then return nil end local nums = {} for _, prefix in ipairs{'cat', 'category', 'all'} do args[prefix .. '1'] = args[prefix] nums = union(nums, getArgNums(args, prefix)) end -- The following is roughly equivalent to the old {{Ambox/category}}. local date = args.date date = type(date) == 'string' and date local preposition = 'from' for _, num in ipairs(nums) do local mainCat = args['cat' .. tostring(num)] or args['category' .. tostring(num)] local allCat = args['all' .. tostring(num)] mainCat = type(mainCat) == 'string' and mainCat allCat = type(allCat) == 'string' and allCat if mainCat and date and date ~= '' then local catTitle = string.format('%s %s %s', mainCat, preposition, date) self:addCat(0, catTitle) catTitle = getTitleObject('Category:' .. catTitle) if not catTitle or not catTitle.exists then self:addCat(0, 'Articles with invalid date parameter in template') end elseif mainCat and (not date or date == '') then self:addCat(0, mainCat) end if allCat then self:addCat(0, allCat) end end end function MessageBox:setTemplateCategories() local args = self.args local cfg = self.cfg -- Add template categories. if cfg.templateCategory then if cfg.templateCategoryRequireName then if self.isTemplatePage then self:addCat(10, cfg.templateCategory) end elseif not self.title.isSubpage then self:addCat(10, cfg.templateCategory) end end -- Add template error categories. if cfg.templateErrorCategory then local templateErrorCategory = cfg.templateErrorCategory local templateCat, templateSort if not self.name and not self.title.isSubpage then templateCat = templateErrorCategory elseif self.isTemplatePage then local paramsToCheck = cfg.templateErrorParamsToCheck or {} local count = 0 for i, param in ipairs(paramsToCheck) do if not args[param] then count = count + 1 end end if count > 0 then templateCat = templateErrorCategory templateSort = tostring(count) end if self.categoryNums and #self.categoryNums > 0 then templateCat = templateErrorCategory templateSort = 'C' end end self:addCat(10, templateCat, templateSort) end end function MessageBox:setAllNamespaceCategories() -- Set categories for all namespaces. if self.invalidTypeError then local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText self:addCat('all', 'Wikipedia message box parameter needs fixing', allSort) end if self.isSubstituted then self:addCat('all', 'Pages with incorrectly substituted templates') end end function MessageBox:setCategories() if self.title.namespace == 0 then self:setMainspaceCategories() elseif self.title.namespace == 10 then self:setTemplateCategories() end self:setAllNamespaceCategories() end function MessageBox:renderCategories() if not self.hasCategories then -- No categories added, no need to pass them to Category handler so, -- if it was invoked, it would return the empty string. -- So we shortcut and return the empty string. return "" end -- Convert category tables to strings and pass them through -- [[Module:Category handler]]. return require('Module:Category handler')._main{ main = table.concat(self.categories[0] or {}), template = table.concat(self.categories[10] or {}), all = table.concat(self.categories.all or {}), nocat = self.args.nocat, page = self.args.page } end function MessageBox:export() local root = mw.html.create() -- Add the subst check error. if self.isSubstituted and self.name then root:tag('b') :addClass('error') :wikitext(string.format( 'Template <code>%s[[Template:%s|%s]]%s</code> has been incorrectly substituted.', mw.text.nowiki('{{'), self.name, self.name, mw.text.nowiki('}}') )) end local frame = mw.getCurrentFrame() root:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = self.base_templatestyles }, }) -- Add support for a single custom templatestyles sheet. Undocumented as -- need should be limited and many templates using mbox are substed; we -- don't want to spread templatestyles sheets around to arbitrary places if self.templatestyles then root:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = self.templatestyles }, }) end -- Create the box table. local boxTable = root:tag('table') boxTable:attr('id', self.id or nil) for i, class in ipairs(self.classes or {}) do boxTable:addClass(class or nil) end boxTable :cssText(self.style or nil) :attr('role', 'presentation') if self.attrs then boxTable:attr(self.attrs) end -- Add the left-hand image. local row = boxTable:tag('tr') if self.imageLeft then local imageLeftCell = row:tag('td'):addClass('mbox-image') if self.imageCellDiv then -- If we are using a div, redefine imageLeftCell so that the image -- is inside it. Divs use style="width: 52px;", which limits the -- image width to 52px. If any images in a div are wider than that, -- they may overlap with the text or cause other display problems. imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') end imageLeftCell:wikitext(self.imageLeft or nil) elseif self.imageEmptyCell then -- Some message boxes define an empty cell if no image is specified, and -- some don't. The old template code in templates where empty cells are -- specified gives the following hint: "No image. Cell with some width -- or padding necessary for text cell to have 100% width." row:tag('td') :addClass('mbox-empty-cell') end -- Add the text. local textCell = row:tag('td'):addClass('mbox-text') if self.useCollapsibleTextFields then -- The message box uses advanced text parameters that allow things to be -- collapsible. At the moment, only ambox uses this. textCell:cssText(self.textstyle or nil) local textCellDiv = textCell:tag('div') textCellDiv :addClass('mbox-text-span') :wikitext(self.issue or nil) if (self.talk or self.fix) then textCellDiv:tag('span') :addClass('hide-when-compact') :wikitext(self.talk and (' ' .. self.talk) or nil) :wikitext(self.fix and (' ' .. self.fix) or nil) end textCellDiv:wikitext(self.date and (' ' .. self.date) or nil) if self.info and not self.isSmall then textCellDiv :tag('span') :addClass('hide-when-compact') :wikitext(self.info and (' ' .. self.info) or nil) end if self.removalNotice then textCellDiv:tag('span') :addClass('hide-when-compact') :tag('i') :wikitext(string.format(" (%s)", self.removalNotice)) end else -- Default text formatting - anything goes. textCell :cssText(self.textstyle or nil) :wikitext(self.text or nil) end -- Add the right-hand image. if self.imageRight then local imageRightCell = row:tag('td'):addClass('mbox-imageright') if self.imageCellDiv then -- If we are using a div, redefine imageRightCell so that the image -- is inside it. imageRightCell = imageRightCell:tag('div'):addClass('mbox-image-div') end imageRightCell :wikitext(self.imageRight or nil) end -- Add the below row. if self.below then boxTable:tag('tr') :tag('td') :attr('colspan', self.imageRight and '3' or '2') :addClass('mbox-text') :cssText(self.textstyle or nil) :wikitext(self.below or nil) end -- Add error message for invalid type parameters. if self.invalidTypeError then root:tag('div') :addClass('mbox-invalid-type') :wikitext(string.format( 'This message box is using an invalid "type=%s" parameter and needs fixing.', self.type or '' )) end -- Add categories. root:wikitext(self:renderCategories() or nil) return tostring(root) end -------------------------------------------------------------------------------- -- Exports -------------------------------------------------------------------------------- local p, mt = {}, {} function p._exportClasses() -- For testing. return { MessageBox = MessageBox } end function p.main(boxType, args, cfgTables) local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE)) box:setParameters() box:setCategories() return box:export() end function mt.__index(t, k) return function (frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return t.main(k, getArgs(frame, {trim = false, removeBlanks = false})) end end return setmetatable(p, mt) bdb0ecc9f26f26b9c0ce12a066a183ac9d4f0705 Module:Infobox 828 22 44 2022-12-27T21:29:12Z wikipedia>Izno 0 merge hlist here Scribunto text/plain local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' }, found = false, styles = 'Plainlist/styles.css' }, hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s' }, found = false, styles = 'Hlist/styles.css' } } local function has_list_class(args_to_check) for _, list in pairs(lists) do if not list.found then for _, arg in pairs(args_to_check) do for _, pattern in ipairs(list.patterns) do if mw.ustring.find(arg or '', pattern) then list.found = true break end end if list.found then break end end end end end local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = '' while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '') s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = '' for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = '' end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- [[Special:Diff/849054481]] -- remove when [[:phab:T191516]] is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end -- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '') end end -- Returns the union of the values of two tables, as a sequence. local function union(t1, t2) local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs) if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass }) root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( '[[Category:Pages using infobox templates with ignored data cells]]' ) end elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class }) local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or '') end end local function renderTitle() if not args.title then return end has_rows = true has_list_class({args.titleclass}) root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end local function renderAboveRow() if not args.above then return end has_rows = true has_list_class({ args.aboveclass }) root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end local function renderBelowRow() if not args.below then return end has_rows = true has_list_class({ args.belowclass }) root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ subheaderArgs.rowclass, subheaderArgs.class }) local row = root:tag('tr') row:addClass(subheaderArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or '') end end local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end local function addImageRow(imageArgs) if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ imageArgs.rowclass, imageArgs.class }) local row = root:tag('tr') row:addClass(imageArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or '') end end local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end -- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, '' ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ''):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end -- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows() local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end local function renderNavBar() if not args.name then return end has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(require('Module:Italic title')._main({})) end end -- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end -- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( '[[Category:Pages using embedded infobox templates with the title parameter]]' ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext('[[Category:Articles using infobox templates with no data rows]]') end end --[=[ Loads the templatestyles for the infobox. TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar. ]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame() local hlist_templatestyles = '' if lists.hlist_t.found then hlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.hlist_t.styles } } end local plainlist_templatestyles = '' if lists.plainlist_t.found then plainlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.plainlist_t.styles } } end -- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } } local templatestyles = '' if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ -- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because the rows of interest invoking -- each class may not be on a specific page hlist_templatestyles, plainlist_templatestyles, base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles }) end -- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end -- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table') root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle) has_list_class({ args.bodyclass }) renderTitle() renderAboveRow() else root = mw.html.create() root :wikitext(args.title) end structure_infobox_common() return loadTemplateStyles() .. root end -- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= '' then args[argName] = origArgs[argName] end end -- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end -- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end -- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end -- Parse the data parameters in the same order that the old {{infobox}} did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters() preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end parseDataParameters() return _infobox() end -- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end parseDataParameters() return _infobox() end return p 0ddb7e5c8426d67cd589b710efb9912ddfb67fea Module:Navbar 828 23 46 2022-12-29T18:20:02Z wikipedia>Izno 0 add templatestyles for hlist Scribunto text/plain local p = {} local cfg = mw.loadData('Module:Navbar/configuration') local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end return show end local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', '', ']'} else l = {'[[', '|', ']]'} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style) local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or '' -- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } } local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done() end function p._navbar(args) -- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or '') .. '; color: ' .. font_color .. ';' end end local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style) if is_mini then div:addClass(cfg.classes.mini) end local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list) if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end local frame = mw.getCurrentFrame() -- hlist -> navbar is best-effort to preserve old Common.css ordering. return frame:extensionTag{ name = 'templatestyles', args = { src = cfg.hlist_templatestyles } } .. frame:extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end function p.navbar(frame) return p._navbar(require('Module:Arguments').getArgs(frame)) end return p 79f907e59eaa8bbf8dd50bb751933ebeaaa7eb17 Module:If empty 828 26 52 2023-01-26T18:33:28Z wikipedia>MSGJ 0 lastk is not needed Scribunto text/plain local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false}) for k,v in ipairs(args) do if v ~= '' then return v end end end return p 4790391408957dea3ff9f453834c05f6b379a45c Module:Sidebar 828 16 32 2023-03-14T22:35:53Z wikipedia>Izno 0 move these items to config, discovered during work at meta Scribunto text/plain require('strict') local cfg = mw.loadData('Module:Sidebar/configuration') local p = {} local getArgs = require('Module:Arguments').getArgs --[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles. TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return '' end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return '' end end for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end --[[ For compatibility with the original {{sidebar with collapsible lists}} implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See ([[meta:Help:Newlines and spaces#Automatic newline]]) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end --[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end local function has_navbar(navbar_mode, sidebar_name) return navbar_mode ~= cfg.i18n.navbar_none and navbar_mode ~= cfg.i18n.navbar_off and ( sidebar_name or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~= cfg.i18n.title_not_to_add_navbar ) end local function has_list_class(args, htmlclass) local patterns = { '^' .. htmlclass .. '$', '%s' .. htmlclass .. '$', '^' .. htmlclass .. '%s', '%s' .. htmlclass .. '%s' } for arg, value in pairs(args) do if type(arg) == 'string' and mw.ustring.find(arg, 'class') then for _, pattern in ipairs(patterns) do if mw.ustring.find(args[arg] or '', pattern) then return true end end end end return false end -- there are a lot of list classes in the wild, so we add their TemplateStyles local function add_list_styles(args) local frame = mw.getCurrentFrame() local function add_list_templatestyles(htmlclass, templatestyles) if has_list_class(args, htmlclass) then return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles } } else return '' end end local plainlist_styles = add_list_templatestyles('plainlist', cfg.i18n.plainlist_templatestyles) local hlist_styles = add_list_templatestyles('hlist', cfg.i18n.hlist_templatestyles) -- a second workaround for [[phab:T303378]] -- when that issue is fixed, we can actually use has_navbar not to emit the -- tag here if we want if has_navbar(args.navbar, args.name) and hlist_styles == '' then hlist_styles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.hlist_templatestyles} } end -- hlist -> plainlist is best-effort to preserve old Common.css ordering. [hlist_note] return hlist_styles .. plainlist_styles end -- work around [[phab:T303378]] -- for each arg: find all the templatestyles strip markers, insert them into a -- table. then remove all templatestyles markers from the arg local function move_hiding_templatestyles(args) local gfind = string.gfind local gsub = string.gsub local templatestyles_markers = {} local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)' for k, arg in pairs(args) do for marker in gfind(arg, strip_marker_pattern) do table.insert(templatestyles_markers, marker) end args[k] = gsub(arg, strip_marker_pattern, '') end return templatestyles_markers end --[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local hiding_templatestyles = table.concat(move_hiding_templatestyles(args)) local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style) if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end if args.topimage then local imageCell = root:tag('tr'):tag('td') imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage) if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end if args.image then local imageCell = root:tag('tr'):tag('td') imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image) if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end local rowNums = {} for k, v in pairs(args) do k = '' .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* {{hlist| ...}}" doesn't parse correctly. :newline() end end if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end if not child and has_navbar(args.navbar, args.name) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } } local templatestyles = '' if args['templatestyles'] and args['templatestyles'] ~= '' then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] and args['child templatestyles'] ~= '' then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ add_list_styles(args), -- see [hlist_note] above about ordering base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, hiding_templatestyles, tostring(root), (child and cfg.i18n.category.child or ''), categorizeTemplatesWithInlineStyles(args) }) end local function list_title(args, is_centered_list_titles, num) local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title) local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done() return title_container end --[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end local contentArgs = {} local is_centered_list_titles = false if args['centered list titles'] and args['centered list titles'] ~= '' then is_centered_list_titles = true end for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num])) contentArgs['content' .. num] = tostring(row) end end for k, v in pairs(contentArgs) do args[k] = v end return p.sidebar(frame, args, cfg.i18n.class.collapse) end return p 71fe765846593e025ca2f94371315e9dbb5bb4d2 33 32 2023-08-02T22:42:09Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain require('strict') local cfg = mw.loadData('Module:Sidebar/configuration') local p = {} local getArgs = require('Module:Arguments').getArgs --[[ Categorizes calling templates and modules with a 'style' parameter of any sort for tracking to convert to TemplateStyles. TODO after a long cleanup: Catch sidebars in other namespaces than Template and Module. TODO would probably want to remove /log and /archive as CS1 does ]] local function categorizeTemplatesWithInlineStyles(args) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 and title.namespace ~= 828 then return '' end for _, pattern in ipairs (cfg.i18n.pattern.uncategorized_conversion_titles) do if title.text:match(pattern) then return '' end end for key, _ in pairs(args) do if mw.ustring.find(key, cfg.i18n.pattern.style_conversion) or key == 'width' then return cfg.i18n.category.conversion end end end --[[ For compatibility with the original {{sidebar with collapsible lists}} implementation, which passed some parameters through {{#if}} to trim their whitespace. This also triggered the automatic newline behavior. ]] -- See ([[meta:Help:Newlines and spaces#Automatic newline]]) local function trimAndAddAutomaticNewline(s) s = mw.ustring.gsub(s, "^%s*(.-)%s*$", "%1") if mw.ustring.find(s, '^[#*:;]') or mw.ustring.find(s, '^{|') then return '\n' .. s else return s end end --[[ Finds whether a sidebar has a subgroup sidebar. ]] local function hasSubgroup(s) if mw.ustring.find(s, cfg.i18n.pattern.subgroup) then return true else return false end end local function has_navbar(navbar_mode, sidebar_name) return navbar_mode ~= cfg.i18n.navbar_none and navbar_mode ~= cfg.i18n.navbar_off and ( sidebar_name or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.i18n.pattern.sandbox, '') ~= cfg.i18n.title_not_to_add_navbar ) end local function has_list_class(args, htmlclass) local patterns = { '^' .. htmlclass .. '$', '%s' .. htmlclass .. '$', '^' .. htmlclass .. '%s', '%s' .. htmlclass .. '%s' } for arg, value in pairs(args) do if type(arg) == 'string' and mw.ustring.find(arg, 'class') then for _, pattern in ipairs(patterns) do if mw.ustring.find(args[arg] or '', pattern) then return true end end end end return false end -- there are a lot of list classes in the wild, so we add their TemplateStyles local function add_list_styles(args) local frame = mw.getCurrentFrame() local function add_list_templatestyles(htmlclass, templatestyles) if has_list_class(args, htmlclass) then return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles } } else return '' end end local plainlist_styles = add_list_templatestyles('plainlist', cfg.i18n.plainlist_templatestyles) local hlist_styles = add_list_templatestyles('hlist', cfg.i18n.hlist_templatestyles) -- a second workaround for [[phab:T303378]] -- when that issue is fixed, we can actually use has_navbar not to emit the -- tag here if we want if has_navbar(args.navbar, args.name) and hlist_styles == '' then hlist_styles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.hlist_templatestyles} } end -- hlist -> plainlist is best-effort to preserve old Common.css ordering. [hlist_note] return hlist_styles .. plainlist_styles end -- work around [[phab:T303378]] -- for each arg: find all the templatestyles strip markers, insert them into a -- table. then remove all templatestyles markers from the arg local function move_hiding_templatestyles(args) local gfind = string.gfind local gsub = string.gsub local templatestyles_markers = {} local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)' for k, arg in pairs(args) do for marker in gfind(arg, strip_marker_pattern) do table.insert(templatestyles_markers, marker) end args[k] = gsub(arg, strip_marker_pattern, '') end return templatestyles_markers end --[[ Main sidebar function. Takes the frame, args, and an optional collapsibleClass. The collapsibleClass is and should be used only for sidebars with collapsible lists, as in p.collapsible. ]] function p.sidebar(frame, args, collapsibleClass) if not args then args = getArgs(frame) end local hiding_templatestyles = table.concat(move_hiding_templatestyles(args)) local root = mw.html.create() local child = args.child and mw.text.trim(args.child) == cfg.i18n.child_yes root = root:tag('table') if not child then root :addClass(cfg.i18n.class.sidebar) -- force collapsibleclass to be sidebar-collapse otherwise output nothing :addClass(collapsibleClass == cfg.i18n.class.collapse and cfg.i18n.class.collapse or nil) :addClass('nomobile') :addClass(args.float == cfg.i18n.float_none and cfg.i18n.class.float_none or nil) :addClass(args.float == cfg.i18n.float_left and cfg.i18n.class.float_left or nil) :addClass(args.wraplinks ~= cfg.i18n.wrap_true and cfg.i18n.class.wraplinks or nil) :addClass(args.bodyclass or args.class) :css('width', args.width or nil) :cssText(args.bodystyle or args.style) if args.outertitle then root :tag('caption') :addClass(cfg.i18n.class.outer_title) :addClass(args.outertitleclass) :cssText(args.outertitlestyle) :wikitext(args.outertitle) end if args.topimage then local imageCell = root:tag('tr'):tag('td') imageCell :addClass(cfg.i18n.class.top_image) :addClass(args.topimageclass) :cssText(args.topimagestyle) :wikitext(args.topimage) if args.topcaption then imageCell :tag('div') :addClass(cfg.i18n.class.top_caption) :cssText(args.topcaptionstyle) :wikitext(args.topcaption) end end if args.pretitle then root :tag('tr') :tag('td') :addClass(args.topimage and cfg.i18n.class.pretitle_with_top_image or cfg.i18n.class.pretitle) :addClass(args.pretitleclass) :cssText(args.basestyle) :cssText(args.pretitlestyle) :wikitext(args.pretitle) end else root :addClass(cfg.i18n.class.subgroup) :addClass(args.bodyclass or args.class) :cssText(args.bodystyle or args.style) end if args.title then if child then root :wikitext(args.title) else root :tag('tr') :tag('th') :addClass(args.pretitle and cfg.i18n.class.title_with_pretitle or cfg.i18n.class.title) :addClass(args.titleclass) :cssText(args.basestyle) :cssText(args.titlestyle) :wikitext(args.title) end end if args.image then local imageCell = root:tag('tr'):tag('td') imageCell :addClass(cfg.i18n.class.image) :addClass(args.imageclass) :cssText(args.imagestyle) :wikitext(args.image) if args.caption then imageCell :tag('div') :addClass(cfg.i18n.class.caption) :cssText(args.captionstyle) :wikitext(args.caption) end end if args.above then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.above) :addClass(args.aboveclass) :cssText(args.abovestyle) :newline() -- newline required for bullet-points to work :wikitext(args.above) end local rowNums = {} for k, v in pairs(args) do k = '' .. k local num = k:match('^heading(%d+)$') or k:match('^content(%d+)$') if num then table.insert(rowNums, tonumber(num)) end end table.sort(rowNums) -- remove duplicates from the list (e.g. 3 will be duplicated if both heading3 -- and content3 are specified) for i = #rowNums, 1, -1 do if rowNums[i] == rowNums[i - 1] then table.remove(rowNums, i) end end for i, num in ipairs(rowNums) do local heading = args['heading' .. num] if heading then root :tag('tr') :tag('th') :addClass(cfg.i18n.class.heading) :addClass(args.headingclass) :addClass(args['heading' .. num .. 'class']) :cssText(args.basestyle) :cssText(args.headingstyle) :cssText(args['heading' .. num .. 'style']) :newline() :wikitext(heading) end local content = args['content' .. num] if content then root :tag('tr') :tag('td') :addClass(hasSubgroup(content) and cfg.i18n.class.content_with_subgroup or cfg.i18n.class.content) :addClass(args.contentclass) :addClass(args['content' .. num .. 'class']) :cssText(args.contentstyle) :cssText(args['content' .. num .. 'style']) :newline() :wikitext(content) :done() -- Without a linebreak after the </td>, a nested list like -- "* {{hlist| ...}}" doesn't parse correctly. :newline() end end if args.below then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.below) :addClass(args.belowclass) :cssText(args.belowstyle) :newline() :wikitext(args.below) end if not child and has_navbar(args.navbar, args.name) then root :tag('tr') :tag('td') :addClass(cfg.i18n.class.navbar) :cssText(args.navbarstyle) :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, fontstyle = args.navbarfontstyle }) end local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.i18n.templatestyles } } local templatestyles = '' if args['templatestyles'] and args['templatestyles'] ~= '' then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] and args['child templatestyles'] ~= '' then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] and args['grandchild templatestyles'] ~= '' then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ add_list_styles(args), -- see [hlist_note] above about ordering base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles, hiding_templatestyles, tostring(root), (child and cfg.i18n.category.child or ''), categorizeTemplatesWithInlineStyles(args) }) end local function list_title(args, is_centered_list_titles, num) local title_text = trimAndAddAutomaticNewline(args['list' .. num .. 'title'] or cfg.i18n.default_list_title) local title if is_centered_list_titles then -- collapsible can be finicky, so provide some CSS/HTML to support title = mw.html.create('div') :addClass(cfg.i18n.class.list_title_centered) :wikitext(title_text) else title = mw.html.create() :wikitext(title_text) end local title_container = mw.html.create('div') :addClass(cfg.i18n.class.list_title) -- don't /need/ a listnumtitleclass because you can do -- .templateclass .listnumclass .sidebar-list-title :addClass(args.listtitleclass) :cssText(args.basestyle) :cssText(args.listtitlestyle) :cssText(args['list' .. num .. 'titlestyle']) :node(title) :done() return title_container end --[[ Main entry point for sidebar with collapsible lists. Does the work of creating the collapsible lists themselves and including them into the args. ]] function p.collapsible(frame) local args = getArgs(frame) if not args.name and frame:getParent():getTitle():gsub(cfg.i18n.pattern.collapse_sandbox, '') == cfg.i18n.collapse_title_not_to_add_navbar then args.navbar = cfg.i18n.navbar_none end local contentArgs = {} local is_centered_list_titles = false if args['centered list titles'] and args['centered list titles'] ~= '' then is_centered_list_titles = true end for k, v in pairs(args) do local num = string.match(k, '^list(%d+)$') if num then local expand = args.expanded and (args.expanded == 'all' or args.expanded == args['list' .. num .. 'name']) local row = mw.html.create('div') row :addClass(cfg.i18n.class.list) :addClass('mw-collapsible') :addClass((not expand) and 'mw-collapsed' or nil) :addClass(args['list' .. num .. 'class']) :cssText(args.listframestyle) :cssText(args['list' .. num .. 'framestyle']) :node(list_title(args, is_centered_list_titles, num)) :tag('div') :addClass(cfg.i18n.class.list_content) :addClass('mw-collapsible-content') -- don't /need/ a listnumstyleclass because you can do -- .templatename .listnumclass .sidebar-list :addClass(args.listclass) :cssText(args.liststyle) :cssText(args['list' .. num .. 'style']) :wikitext(trimAndAddAutomaticNewline(args['list' .. num])) contentArgs['content' .. num] = tostring(row) end end for k, v in pairs(contentArgs) do args[k] = v end return p.sidebar(frame, args, cfg.i18n.class.collapse) end return p 71fe765846593e025ca2f94371315e9dbb5bb4d2 Module:Navbox 828 18 36 2023-05-28T13:26:56Z wikipedia>Uzume 0 strict Scribunto text/plain require('strict') local p = {} local navbar = require('Module:Navbar')._navbar local cfg = mw.loadData('Module:Navbox/configuration') local getArgs -- lazily initialized local args local format = string.format local function striped(wikitext, border) -- Return wikitext with markers replaced for odd/even striping. -- Child (subgroup) navboxes are flagged with a category that is removed -- by parent navboxes. The result is that the category shows all pages -- where a child navbox is not contained in a parent navbox. local orphanCat = cfg.category.orphan if border == cfg.keyword.border_subgroup and args[cfg.arg.orphan] ~= cfg.keyword.orphan_yes then -- No change; striping occurs in outermost navbox. return wikitext .. orphanCat end local first, second = cfg.class.navbox_odd_part, cfg.class.navbox_even_part if args[cfg.arg.evenodd] then if args[cfg.arg.evenodd] == cfg.keyword.evenodd_swap then first, second = second, first else first = args[cfg.arg.evenodd] second = first end end local changer if first == second then changer = first else local index = 0 changer = function (code) if code == '0' then -- Current occurrence is for a group before a nested table. -- Set it to first as a valid although pointless class. -- The next occurrence will be the first row after a title -- in a subgroup and will also be first. index = 0 return first end index = index + 1 return index % 2 == 1 and first or second end end local regex = orphanCat:gsub('([%[%]])', '%%%1') return (wikitext:gsub(regex, ''):gsub(cfg.marker.regex, changer)) -- () omits gsub count end local function processItem(item, nowrapitems) if item:sub(1, 2) == '{|' then -- Applying nowrap to lines in a table does not make sense. -- Add newlines to compensate for trim of x in |parm=x in a template. return '\n' .. item ..'\n' end if nowrapitems == cfg.keyword.nowrapitems_yes then local lines = {} for line in (item .. '\n'):gmatch('([^\n]*)\n') do local prefix, content = line:match('^([*:;#]+)%s*(.*)') if prefix and not content:match(cfg.pattern.nowrap) then line = format(cfg.nowrap_item, prefix, content) end table.insert(lines, line) end item = table.concat(lines, '\n') end if item:match('^[*:;#]') then return '\n' .. item ..'\n' end return item end local function has_navbar() return args[cfg.arg.navbar] ~= cfg.keyword.navbar_off and args[cfg.arg.navbar] ~= cfg.keyword.navbar_plain and ( args[cfg.arg.name] or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.pattern.sandbox, '') ~= cfg.pattern.navbox ) end local function renderNavBar(titleCell) if has_navbar() then titleCell:wikitext(navbar{ [cfg.navbar.name] = args[cfg.arg.name], [cfg.navbar.mini] = 1, [cfg.navbar.fontstyle] = (args[cfg.arg.basestyle] or '') .. ';' .. (args[cfg.arg.titlestyle] or '') .. ';background:none transparent;border:none;box-shadow:none;padding:0;' }) end end local function renderTitleRow(tbl) if not args[cfg.arg.title] then return end local titleRow = tbl:tag('tr') local titleCell = titleRow:tag('th'):attr('scope', 'col') local titleColspan = 2 if args[cfg.arg.imageleft] then titleColspan = titleColspan + 1 end if args[cfg.arg.image] then titleColspan = titleColspan + 1 end titleCell :cssText(args[cfg.arg.basestyle]) :cssText(args[cfg.arg.titlestyle]) :addClass(cfg.class.navbox_title) :attr('colspan', titleColspan) renderNavBar(titleCell) titleCell :tag('div') -- id for aria-labelledby attribute :attr('id', mw.uri.anchorEncode(args[cfg.arg.title])) :addClass(args[cfg.arg.titleclass]) :css('font-size', '114%') :css('margin', '0 4em') :wikitext(processItem(args[cfg.arg.title])) end local function getAboveBelowColspan() local ret = 2 if args[cfg.arg.imageleft] then ret = ret + 1 end if args[cfg.arg.image] then ret = ret + 1 end return ret end local function renderAboveRow(tbl) if not args[cfg.arg.above] then return end tbl:tag('tr') :tag('td') :addClass(cfg.class.navbox_abovebelow) :addClass(args[cfg.arg.aboveclass]) :cssText(args[cfg.arg.basestyle]) :cssText(args[cfg.arg.abovestyle]) :attr('colspan', getAboveBelowColspan()) :tag('div') -- id for aria-labelledby attribute, if no title :attr('id', (not args[cfg.arg.title]) and mw.uri.anchorEncode(args[cfg.arg.above]) or nil) :wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems])) end local function renderBelowRow(tbl) if not args[cfg.arg.below] then return end tbl:tag('tr') :tag('td') :addClass(cfg.class.navbox_abovebelow) :addClass(args[cfg.arg.belowclass]) :cssText(args[cfg.arg.basestyle]) :cssText(args[cfg.arg.belowstyle]) :attr('colspan', getAboveBelowColspan()) :tag('div') :wikitext(processItem(args[cfg.arg.below], args[cfg.arg.nowrapitems])) end local function renderListRow(tbl, index, listnum, listnums_size) local row = tbl:tag('tr') if index == 1 and args[cfg.arg.imageleft] then row :tag('td') :addClass(cfg.class.noviewer) :addClass(cfg.class.navbox_image) :addClass(args[cfg.arg.imageclass]) :css('width', '1px') -- Minimize width :css('padding', '0 2px 0 0') :cssText(args[cfg.arg.imageleftstyle]) :attr('rowspan', listnums_size) :tag('div') :wikitext(processItem(args[cfg.arg.imageleft])) end local group_and_num = format(cfg.arg.group_and_num, listnum) local groupstyle_and_num = format(cfg.arg.groupstyle_and_num, listnum) if args[group_and_num] then local groupCell = row:tag('th') -- id for aria-labelledby attribute, if lone group with no title or above if listnum == 1 and not (args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group2]) then groupCell :attr('id', mw.uri.anchorEncode(args[cfg.arg.group1])) end groupCell :attr('scope', 'row') :addClass(cfg.class.navbox_group) :addClass(args[cfg.arg.groupclass]) :cssText(args[cfg.arg.basestyle]) -- If groupwidth not specified, minimize width :css('width', args[cfg.arg.groupwidth] or '1%') groupCell :cssText(args[cfg.arg.groupstyle]) :cssText(args[groupstyle_and_num]) :wikitext(args[group_and_num]) end local listCell = row:tag('td') if args[group_and_num] then listCell :addClass(cfg.class.navbox_list_with_group) else listCell:attr('colspan', 2) end if not args[cfg.arg.groupwidth] then listCell:css('width', '100%') end local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing if index % 2 == 1 then rowstyle = args[cfg.arg.oddstyle] else rowstyle = args[cfg.arg.evenstyle] end local list_and_num = format(cfg.arg.list_and_num, listnum) local listText = args[list_and_num] local oddEven = cfg.marker.oddeven if listText:sub(1, 12) == '</div><table' then -- Assume list text is for a subgroup navbox so no automatic striping for this row. oddEven = listText:find(cfg.pattern.navbox_title) and cfg.marker.restart or cfg.class.navbox_odd_part end local liststyle_and_num = format(cfg.arg.liststyle_and_num, listnum) local listclass_and_num = format(cfg.arg.listclass_and_num, listnum) listCell :css('padding', '0') :cssText(args[cfg.arg.liststyle]) :cssText(rowstyle) :cssText(args[liststyle_and_num]) :addClass(cfg.class.navbox_list) :addClass(cfg.class.navbox_part .. oddEven) :addClass(args[cfg.arg.listclass]) :addClass(args[listclass_and_num]) :tag('div') :css('padding', (index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0 0.25em' ) :wikitext(processItem(listText, args[cfg.arg.nowrapitems])) if index == 1 and args[cfg.arg.image] then row :tag('td') :addClass(cfg.class.noviewer) :addClass(cfg.class.navbox_image) :addClass(args[cfg.arg.imageclass]) :css('width', '1px') -- Minimize width :css('padding', '0 0 0 2px') :cssText(args[cfg.arg.imagestyle]) :attr('rowspan', listnums_size) :tag('div') :wikitext(processItem(args[cfg.arg.image])) end end local function has_list_class(htmlclass) local patterns = { '^' .. htmlclass .. '$', '%s' .. htmlclass .. '$', '^' .. htmlclass .. '%s', '%s' .. htmlclass .. '%s' } for arg, _ in pairs(args) do if type(arg) == 'string' and mw.ustring.find(arg, cfg.pattern.class) then for _, pattern in ipairs(patterns) do if mw.ustring.find(args[arg] or '', pattern) then return true end end end end return false end -- there are a lot of list classes in the wild, so we add their TemplateStyles local function add_list_styles() local frame = mw.getCurrentFrame() local function add_list_templatestyles(htmlclass, templatestyles) if has_list_class(htmlclass) then return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles } } else return '' end end local hlist_styles = add_list_templatestyles('hlist', cfg.hlist_templatestyles) local plainlist_styles = add_list_templatestyles('plainlist', cfg.plainlist_templatestyles) -- a second workaround for [[phab:T303378]] -- when that issue is fixed, we can actually use has_navbar not to emit the -- tag here if we want if has_navbar() and hlist_styles == '' then hlist_styles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.hlist_templatestyles } } end -- hlist -> plainlist is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because most navboxes will emit only -- one of these classes [hlist_note] return hlist_styles .. plainlist_styles end local function needsHorizontalLists(border) if border == cfg.keyword.border_subgroup or args[cfg.arg.tracking] == cfg.keyword.tracking_no then return false end return not has_list_class(cfg.pattern.hlist) and not has_list_class(cfg.pattern.plainlist) end local function hasBackgroundColors() for _, key in ipairs({cfg.arg.titlestyle, cfg.arg.groupstyle, cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do if tostring(args[key]):find('background', 1, true) then return true end end return false end local function hasBorders() for _, key in ipairs({cfg.arg.groupstyle, cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do if tostring(args[key]):find('border', 1, true) then return true end end return false end local function isIllegible() local styleratio = require('Module:Color contrast')._styleratio for key, style in pairs(args) do if tostring(key):match(cfg.pattern.style) then if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then return true end end end return false end local function getTrackingCategories(border) local cats = {} if needsHorizontalLists(border) then table.insert(cats, cfg.category.horizontal_lists) end if hasBackgroundColors() then table.insert(cats, cfg.category.background_colors) end if isIllegible() then table.insert(cats, cfg.category.illegible) end if hasBorders() then table.insert(cats, cfg.category.borders) end return cats end local function renderTrackingCategories(builder, border) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 then return end -- not in template space local subpage = title.subpageText if subpage == cfg.keyword.subpage_doc or subpage == cfg.keyword.subpage_sandbox or subpage == cfg.keyword.subpage_testcases then return end for _, cat in ipairs(getTrackingCategories(border)) do builder:wikitext('[[Category:' .. cat .. ']]') end end local function renderMainTable(border, listnums) local tbl = mw.html.create('table') :addClass(cfg.class.nowraplinks) :addClass(args[cfg.arg.bodyclass]) local state = args[cfg.arg.state] if args[cfg.arg.title] and state ~= cfg.keyword.state_plain and state ~= cfg.keyword.state_off then if state == cfg.keyword.state_collapsed then state = cfg.class.collapsed end tbl :addClass(cfg.class.collapsible) :addClass(state or cfg.class.autocollapse) end tbl:css('border-spacing', 0) if border == cfg.keyword.border_subgroup or border == cfg.keyword.border_none then tbl :addClass(cfg.class.navbox_subgroup) :cssText(args[cfg.arg.bodystyle]) :cssText(args[cfg.arg.style]) else -- regular navbox - bodystyle and style will be applied to the wrapper table tbl :addClass(cfg.class.navbox_inner) :css('background', 'transparent') :css('color', 'inherit') end tbl:cssText(args[cfg.arg.innerstyle]) renderTitleRow(tbl) renderAboveRow(tbl) local listnums_size = #listnums for i, listnum in ipairs(listnums) do renderListRow(tbl, i, listnum, listnums_size) end renderBelowRow(tbl) return tbl end local function add_navbox_styles(hiding_templatestyles) local frame = mw.getCurrentFrame() -- This is a lambda so that it doesn't need the frame as a parameter local function add_user_styles(templatestyles) if templatestyles and templatestyles ~= '' then return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles } } end return '' end -- get templatestyles. load base from config so that Lua only needs to do -- the work once of parser tag expansion local base_templatestyles = cfg.templatestyles local templatestyles = add_user_styles(args[cfg.arg.templatestyles]) local child_templatestyles = add_user_styles(args[cfg.arg.child_templatestyles]) -- The 'navbox-styles' div exists to wrap the styles to work around T200206 -- more elegantly. Instead of combinatorial rules, this ends up being linear -- number of CSS rules. return mw.html.create('div') :addClass(cfg.class.navbox_styles) :wikitext( add_list_styles() .. -- see [hlist_note] applied to 'before base_templatestyles' base_templatestyles .. templatestyles .. child_templatestyles .. table.concat(hiding_templatestyles) ) :done() end -- work around [[phab:T303378]] -- for each arg: find all the templatestyles strip markers, insert them into a -- table. then remove all templatestyles markers from the arg local function move_hiding_templatestyles(args) local gfind = string.gfind local gsub = string.gsub local templatestyles_markers = {} local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)' for k, arg in pairs(args) do for marker in gfind(arg, strip_marker_pattern) do table.insert(templatestyles_markers, marker) end args[k] = gsub(arg, strip_marker_pattern, '') end return templatestyles_markers end function p._navbox(navboxArgs) args = navboxArgs local hiding_templatestyles = move_hiding_templatestyles(args) local listnums = {} for k, _ in pairs(args) do if type(k) == 'string' then local listnum = k:match(cfg.pattern.listnum) if listnum then table.insert(listnums, tonumber(listnum)) end end end table.sort(listnums) local border = mw.text.trim(args[cfg.arg.border] or args[1] or '') if border == cfg.keyword.border_child then border = cfg.keyword.border_subgroup end -- render the main body of the navbox local tbl = renderMainTable(border, listnums) local res = mw.html.create() -- render the appropriate wrapper for the navbox, based on the border param if border == cfg.keyword.border_none then res:node(add_navbox_styles(hiding_templatestyles)) local nav = res:tag('div') :attr('role', 'navigation') :node(tbl) -- aria-labelledby title, otherwise above, otherwise lone group if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then nav:attr( 'aria-labelledby', mw.uri.anchorEncode( args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1] ) ) else nav:attr('aria-label', cfg.aria_label) end elseif border == cfg.keyword.border_subgroup then -- We assume that this navbox is being rendered in a list cell of a -- parent navbox, and is therefore inside a div with padding:0em 0.25em. -- We start with a </div> to avoid the padding being applied, and at the -- end add a <div> to balance out the parent's </div> res :wikitext('</div>') :node(tbl) :wikitext('<div>') else res:node(add_navbox_styles(hiding_templatestyles)) local nav = res:tag('div') :attr('role', 'navigation') :addClass(cfg.class.navbox) :addClass(args[cfg.arg.navboxclass]) :cssText(args[cfg.arg.bodystyle]) :cssText(args[cfg.arg.style]) :css('padding', '3px') :node(tbl) -- aria-labelledby title, otherwise above, otherwise lone group if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then nav:attr( 'aria-labelledby', mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]) ) else nav:attr('aria-label', cfg.aria_label) end end if (args[cfg.arg.nocat] or cfg.keyword.nocat_false):lower() == cfg.keyword.nocat_false then renderTrackingCategories(res, border) end return striped(tostring(res), border) end function p.navbox(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end args = getArgs(frame, {wrappers = {cfg.pattern.navbox}}) -- Read the arguments in the order they'll be output in, to make references -- number in the right order. local _ _ = args[cfg.arg.title] _ = args[cfg.arg.above] -- Limit this to 20 as covering 'most' cases (that's a SWAG) and because -- iterator approach won't work here for i = 1, 20 do _ = args[format(cfg.arg.group_and_num, i)] _ = args[format(cfg.arg.list_and_num, i)] end _ = args[cfg.arg.below] return p._navbox(args) end return p 05be9a97c035ab3f0fac69423779e261949d473c 37 36 2023-08-02T22:42:10Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain require('strict') local p = {} local navbar = require('Module:Navbar')._navbar local cfg = mw.loadData('Module:Navbox/configuration') local getArgs -- lazily initialized local args local format = string.format local function striped(wikitext, border) -- Return wikitext with markers replaced for odd/even striping. -- Child (subgroup) navboxes are flagged with a category that is removed -- by parent navboxes. The result is that the category shows all pages -- where a child navbox is not contained in a parent navbox. local orphanCat = cfg.category.orphan if border == cfg.keyword.border_subgroup and args[cfg.arg.orphan] ~= cfg.keyword.orphan_yes then -- No change; striping occurs in outermost navbox. return wikitext .. orphanCat end local first, second = cfg.class.navbox_odd_part, cfg.class.navbox_even_part if args[cfg.arg.evenodd] then if args[cfg.arg.evenodd] == cfg.keyword.evenodd_swap then first, second = second, first else first = args[cfg.arg.evenodd] second = first end end local changer if first == second then changer = first else local index = 0 changer = function (code) if code == '0' then -- Current occurrence is for a group before a nested table. -- Set it to first as a valid although pointless class. -- The next occurrence will be the first row after a title -- in a subgroup and will also be first. index = 0 return first end index = index + 1 return index % 2 == 1 and first or second end end local regex = orphanCat:gsub('([%[%]])', '%%%1') return (wikitext:gsub(regex, ''):gsub(cfg.marker.regex, changer)) -- () omits gsub count end local function processItem(item, nowrapitems) if item:sub(1, 2) == '{|' then -- Applying nowrap to lines in a table does not make sense. -- Add newlines to compensate for trim of x in |parm=x in a template. return '\n' .. item ..'\n' end if nowrapitems == cfg.keyword.nowrapitems_yes then local lines = {} for line in (item .. '\n'):gmatch('([^\n]*)\n') do local prefix, content = line:match('^([*:;#]+)%s*(.*)') if prefix and not content:match(cfg.pattern.nowrap) then line = format(cfg.nowrap_item, prefix, content) end table.insert(lines, line) end item = table.concat(lines, '\n') end if item:match('^[*:;#]') then return '\n' .. item ..'\n' end return item end local function has_navbar() return args[cfg.arg.navbar] ~= cfg.keyword.navbar_off and args[cfg.arg.navbar] ~= cfg.keyword.navbar_plain and ( args[cfg.arg.name] or mw.getCurrentFrame():getParent():getTitle():gsub(cfg.pattern.sandbox, '') ~= cfg.pattern.navbox ) end local function renderNavBar(titleCell) if has_navbar() then titleCell:wikitext(navbar{ [cfg.navbar.name] = args[cfg.arg.name], [cfg.navbar.mini] = 1, [cfg.navbar.fontstyle] = (args[cfg.arg.basestyle] or '') .. ';' .. (args[cfg.arg.titlestyle] or '') .. ';background:none transparent;border:none;box-shadow:none;padding:0;' }) end end local function renderTitleRow(tbl) if not args[cfg.arg.title] then return end local titleRow = tbl:tag('tr') local titleCell = titleRow:tag('th'):attr('scope', 'col') local titleColspan = 2 if args[cfg.arg.imageleft] then titleColspan = titleColspan + 1 end if args[cfg.arg.image] then titleColspan = titleColspan + 1 end titleCell :cssText(args[cfg.arg.basestyle]) :cssText(args[cfg.arg.titlestyle]) :addClass(cfg.class.navbox_title) :attr('colspan', titleColspan) renderNavBar(titleCell) titleCell :tag('div') -- id for aria-labelledby attribute :attr('id', mw.uri.anchorEncode(args[cfg.arg.title])) :addClass(args[cfg.arg.titleclass]) :css('font-size', '114%') :css('margin', '0 4em') :wikitext(processItem(args[cfg.arg.title])) end local function getAboveBelowColspan() local ret = 2 if args[cfg.arg.imageleft] then ret = ret + 1 end if args[cfg.arg.image] then ret = ret + 1 end return ret end local function renderAboveRow(tbl) if not args[cfg.arg.above] then return end tbl:tag('tr') :tag('td') :addClass(cfg.class.navbox_abovebelow) :addClass(args[cfg.arg.aboveclass]) :cssText(args[cfg.arg.basestyle]) :cssText(args[cfg.arg.abovestyle]) :attr('colspan', getAboveBelowColspan()) :tag('div') -- id for aria-labelledby attribute, if no title :attr('id', (not args[cfg.arg.title]) and mw.uri.anchorEncode(args[cfg.arg.above]) or nil) :wikitext(processItem(args[cfg.arg.above], args[cfg.arg.nowrapitems])) end local function renderBelowRow(tbl) if not args[cfg.arg.below] then return end tbl:tag('tr') :tag('td') :addClass(cfg.class.navbox_abovebelow) :addClass(args[cfg.arg.belowclass]) :cssText(args[cfg.arg.basestyle]) :cssText(args[cfg.arg.belowstyle]) :attr('colspan', getAboveBelowColspan()) :tag('div') :wikitext(processItem(args[cfg.arg.below], args[cfg.arg.nowrapitems])) end local function renderListRow(tbl, index, listnum, listnums_size) local row = tbl:tag('tr') if index == 1 and args[cfg.arg.imageleft] then row :tag('td') :addClass(cfg.class.noviewer) :addClass(cfg.class.navbox_image) :addClass(args[cfg.arg.imageclass]) :css('width', '1px') -- Minimize width :css('padding', '0 2px 0 0') :cssText(args[cfg.arg.imageleftstyle]) :attr('rowspan', listnums_size) :tag('div') :wikitext(processItem(args[cfg.arg.imageleft])) end local group_and_num = format(cfg.arg.group_and_num, listnum) local groupstyle_and_num = format(cfg.arg.groupstyle_and_num, listnum) if args[group_and_num] then local groupCell = row:tag('th') -- id for aria-labelledby attribute, if lone group with no title or above if listnum == 1 and not (args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group2]) then groupCell :attr('id', mw.uri.anchorEncode(args[cfg.arg.group1])) end groupCell :attr('scope', 'row') :addClass(cfg.class.navbox_group) :addClass(args[cfg.arg.groupclass]) :cssText(args[cfg.arg.basestyle]) -- If groupwidth not specified, minimize width :css('width', args[cfg.arg.groupwidth] or '1%') groupCell :cssText(args[cfg.arg.groupstyle]) :cssText(args[groupstyle_and_num]) :wikitext(args[group_and_num]) end local listCell = row:tag('td') if args[group_and_num] then listCell :addClass(cfg.class.navbox_list_with_group) else listCell:attr('colspan', 2) end if not args[cfg.arg.groupwidth] then listCell:css('width', '100%') end local rowstyle -- usually nil so cssText(rowstyle) usually adds nothing if index % 2 == 1 then rowstyle = args[cfg.arg.oddstyle] else rowstyle = args[cfg.arg.evenstyle] end local list_and_num = format(cfg.arg.list_and_num, listnum) local listText = args[list_and_num] local oddEven = cfg.marker.oddeven if listText:sub(1, 12) == '</div><table' then -- Assume list text is for a subgroup navbox so no automatic striping for this row. oddEven = listText:find(cfg.pattern.navbox_title) and cfg.marker.restart or cfg.class.navbox_odd_part end local liststyle_and_num = format(cfg.arg.liststyle_and_num, listnum) local listclass_and_num = format(cfg.arg.listclass_and_num, listnum) listCell :css('padding', '0') :cssText(args[cfg.arg.liststyle]) :cssText(rowstyle) :cssText(args[liststyle_and_num]) :addClass(cfg.class.navbox_list) :addClass(cfg.class.navbox_part .. oddEven) :addClass(args[cfg.arg.listclass]) :addClass(args[listclass_and_num]) :tag('div') :css('padding', (index == 1 and args[cfg.arg.list1padding]) or args[cfg.arg.listpadding] or '0 0.25em' ) :wikitext(processItem(listText, args[cfg.arg.nowrapitems])) if index == 1 and args[cfg.arg.image] then row :tag('td') :addClass(cfg.class.noviewer) :addClass(cfg.class.navbox_image) :addClass(args[cfg.arg.imageclass]) :css('width', '1px') -- Minimize width :css('padding', '0 0 0 2px') :cssText(args[cfg.arg.imagestyle]) :attr('rowspan', listnums_size) :tag('div') :wikitext(processItem(args[cfg.arg.image])) end end local function has_list_class(htmlclass) local patterns = { '^' .. htmlclass .. '$', '%s' .. htmlclass .. '$', '^' .. htmlclass .. '%s', '%s' .. htmlclass .. '%s' } for arg, _ in pairs(args) do if type(arg) == 'string' and mw.ustring.find(arg, cfg.pattern.class) then for _, pattern in ipairs(patterns) do if mw.ustring.find(args[arg] or '', pattern) then return true end end end end return false end -- there are a lot of list classes in the wild, so we add their TemplateStyles local function add_list_styles() local frame = mw.getCurrentFrame() local function add_list_templatestyles(htmlclass, templatestyles) if has_list_class(htmlclass) then return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles } } else return '' end end local hlist_styles = add_list_templatestyles('hlist', cfg.hlist_templatestyles) local plainlist_styles = add_list_templatestyles('plainlist', cfg.plainlist_templatestyles) -- a second workaround for [[phab:T303378]] -- when that issue is fixed, we can actually use has_navbar not to emit the -- tag here if we want if has_navbar() and hlist_styles == '' then hlist_styles = frame:extensionTag{ name = 'templatestyles', args = { src = cfg.hlist_templatestyles } } end -- hlist -> plainlist is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because most navboxes will emit only -- one of these classes [hlist_note] return hlist_styles .. plainlist_styles end local function needsHorizontalLists(border) if border == cfg.keyword.border_subgroup or args[cfg.arg.tracking] == cfg.keyword.tracking_no then return false end return not has_list_class(cfg.pattern.hlist) and not has_list_class(cfg.pattern.plainlist) end local function hasBackgroundColors() for _, key in ipairs({cfg.arg.titlestyle, cfg.arg.groupstyle, cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do if tostring(args[key]):find('background', 1, true) then return true end end return false end local function hasBorders() for _, key in ipairs({cfg.arg.groupstyle, cfg.arg.basestyle, cfg.arg.abovestyle, cfg.arg.belowstyle}) do if tostring(args[key]):find('border', 1, true) then return true end end return false end local function isIllegible() local styleratio = require('Module:Color contrast')._styleratio for key, style in pairs(args) do if tostring(key):match(cfg.pattern.style) then if styleratio{mw.text.unstripNoWiki(style)} < 4.5 then return true end end end return false end local function getTrackingCategories(border) local cats = {} if needsHorizontalLists(border) then table.insert(cats, cfg.category.horizontal_lists) end if hasBackgroundColors() then table.insert(cats, cfg.category.background_colors) end if isIllegible() then table.insert(cats, cfg.category.illegible) end if hasBorders() then table.insert(cats, cfg.category.borders) end return cats end local function renderTrackingCategories(builder, border) local title = mw.title.getCurrentTitle() if title.namespace ~= 10 then return end -- not in template space local subpage = title.subpageText if subpage == cfg.keyword.subpage_doc or subpage == cfg.keyword.subpage_sandbox or subpage == cfg.keyword.subpage_testcases then return end for _, cat in ipairs(getTrackingCategories(border)) do builder:wikitext('[[Category:' .. cat .. ']]') end end local function renderMainTable(border, listnums) local tbl = mw.html.create('table') :addClass(cfg.class.nowraplinks) :addClass(args[cfg.arg.bodyclass]) local state = args[cfg.arg.state] if args[cfg.arg.title] and state ~= cfg.keyword.state_plain and state ~= cfg.keyword.state_off then if state == cfg.keyword.state_collapsed then state = cfg.class.collapsed end tbl :addClass(cfg.class.collapsible) :addClass(state or cfg.class.autocollapse) end tbl:css('border-spacing', 0) if border == cfg.keyword.border_subgroup or border == cfg.keyword.border_none then tbl :addClass(cfg.class.navbox_subgroup) :cssText(args[cfg.arg.bodystyle]) :cssText(args[cfg.arg.style]) else -- regular navbox - bodystyle and style will be applied to the wrapper table tbl :addClass(cfg.class.navbox_inner) :css('background', 'transparent') :css('color', 'inherit') end tbl:cssText(args[cfg.arg.innerstyle]) renderTitleRow(tbl) renderAboveRow(tbl) local listnums_size = #listnums for i, listnum in ipairs(listnums) do renderListRow(tbl, i, listnum, listnums_size) end renderBelowRow(tbl) return tbl end local function add_navbox_styles(hiding_templatestyles) local frame = mw.getCurrentFrame() -- This is a lambda so that it doesn't need the frame as a parameter local function add_user_styles(templatestyles) if templatestyles and templatestyles ~= '' then return frame:extensionTag{ name = 'templatestyles', args = { src = templatestyles } } end return '' end -- get templatestyles. load base from config so that Lua only needs to do -- the work once of parser tag expansion local base_templatestyles = cfg.templatestyles local templatestyles = add_user_styles(args[cfg.arg.templatestyles]) local child_templatestyles = add_user_styles(args[cfg.arg.child_templatestyles]) -- The 'navbox-styles' div exists to wrap the styles to work around T200206 -- more elegantly. Instead of combinatorial rules, this ends up being linear -- number of CSS rules. return mw.html.create('div') :addClass(cfg.class.navbox_styles) :wikitext( add_list_styles() .. -- see [hlist_note] applied to 'before base_templatestyles' base_templatestyles .. templatestyles .. child_templatestyles .. table.concat(hiding_templatestyles) ) :done() end -- work around [[phab:T303378]] -- for each arg: find all the templatestyles strip markers, insert them into a -- table. then remove all templatestyles markers from the arg local function move_hiding_templatestyles(args) local gfind = string.gfind local gsub = string.gsub local templatestyles_markers = {} local strip_marker_pattern = '(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)' for k, arg in pairs(args) do for marker in gfind(arg, strip_marker_pattern) do table.insert(templatestyles_markers, marker) end args[k] = gsub(arg, strip_marker_pattern, '') end return templatestyles_markers end function p._navbox(navboxArgs) args = navboxArgs local hiding_templatestyles = move_hiding_templatestyles(args) local listnums = {} for k, _ in pairs(args) do if type(k) == 'string' then local listnum = k:match(cfg.pattern.listnum) if listnum then table.insert(listnums, tonumber(listnum)) end end end table.sort(listnums) local border = mw.text.trim(args[cfg.arg.border] or args[1] or '') if border == cfg.keyword.border_child then border = cfg.keyword.border_subgroup end -- render the main body of the navbox local tbl = renderMainTable(border, listnums) local res = mw.html.create() -- render the appropriate wrapper for the navbox, based on the border param if border == cfg.keyword.border_none then res:node(add_navbox_styles(hiding_templatestyles)) local nav = res:tag('div') :attr('role', 'navigation') :node(tbl) -- aria-labelledby title, otherwise above, otherwise lone group if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then nav:attr( 'aria-labelledby', mw.uri.anchorEncode( args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1] ) ) else nav:attr('aria-label', cfg.aria_label) end elseif border == cfg.keyword.border_subgroup then -- We assume that this navbox is being rendered in a list cell of a -- parent navbox, and is therefore inside a div with padding:0em 0.25em. -- We start with a </div> to avoid the padding being applied, and at the -- end add a <div> to balance out the parent's </div> res :wikitext('</div>') :node(tbl) :wikitext('<div>') else res:node(add_navbox_styles(hiding_templatestyles)) local nav = res:tag('div') :attr('role', 'navigation') :addClass(cfg.class.navbox) :addClass(args[cfg.arg.navboxclass]) :cssText(args[cfg.arg.bodystyle]) :cssText(args[cfg.arg.style]) :css('padding', '3px') :node(tbl) -- aria-labelledby title, otherwise above, otherwise lone group if args[cfg.arg.title] or args[cfg.arg.above] or (args[cfg.arg.group1] and not args[cfg.arg.group2]) then nav:attr( 'aria-labelledby', mw.uri.anchorEncode(args[cfg.arg.title] or args[cfg.arg.above] or args[cfg.arg.group1]) ) else nav:attr('aria-label', cfg.aria_label) end end if (args[cfg.arg.nocat] or cfg.keyword.nocat_false):lower() == cfg.keyword.nocat_false then renderTrackingCategories(res, border) end return striped(tostring(res), border) end function p.navbox(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end args = getArgs(frame, {wrappers = {cfg.pattern.navbox}}) -- Read the arguments in the order they'll be output in, to make references -- number in the right order. local _ _ = args[cfg.arg.title] _ = args[cfg.arg.above] -- Limit this to 20 as covering 'most' cases (that's a SWAG) and because -- iterator approach won't work here for i = 1, 20 do _ = args[format(cfg.arg.group_and_num, i)] _ = args[format(cfg.arg.list_and_num, i)] end _ = args[cfg.arg.below] return p._navbox(args) end return p 05be9a97c035ab3f0fac69423779e261949d473c Template:Infobox/doc 10 30 60 2023-07-14T10:12:10Z wikipedia>Grufo 0 Internal links wikitext text/x-wiki {{Documentation subpage}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{distinguish|Template:Userbox}} {{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}} {{Lua|Module:Infobox}} {{Parameter names example |name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>...... |image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>...... |header1=<div style="border-top:1px dashed #ccc;">{{{header1}}}<br/>{{nobold|( ''or'' )}}</div> |label2={{{label1}}} |data2={{{data1}}} |data3=( ''or'' ) |data4=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data1}}}</div> |header5={{{header2}}}<br/><div style="padding:0.75em 0 0.5em;">{{nobold|( ''or'' )}}</div> |label6={{{label2}}} |data6={{{data2}}} |data7=( ''or'' ) |data8=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data2}}}</div> |data9=<div style="padding:0.75em 0 0.5em;">( ''etc'' )</div> |below }} This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required (for a template specialized on this usage see {{tl|Unstructured infobox}}). [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes. == Usage == {{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox building}}). For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified: <syntaxhighlight lang="wikitext"> {{Infobox | name = {{{name|{{PAGENAME}}}}} | image = {{{image|}}} | caption1 = {{{caption|}}} | label1 = Former names | data1 = {{{former_names|}}} | header2 = General information | label3 = Status | data3 = {{{status|}}} ... <!-- etc. --> }} </syntaxhighlight> == Optional control parameters == ; name : If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page, prefixed by <code>Template:</code> if no namespace is specified. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change. ; child : See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it. ; subbox : See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes". ; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it. ; autoheaders: If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "[[#Hiding headers when all its data fields are empty|hiding headers when all its data fields are empty]]" section for more details. == Content parameters == === Title === There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended): ; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative. ; above : Text to put within the uppermost cell of the table. ; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images. Examples: {{Infobox | name = Infobox/doc | title = Text in caption over infobox | subheader = Subheader of the infobox | header = (the rest of the infobox goes here) }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | name = {{subst:PAGENAME}} | title = Text in caption over infobox | subheader = Subheader of the infobox | header = (the rest of the infobox goes here) }} </syntaxhighlight>{{clear}} {{Infobox | name = Infobox/doc | above = Text in uppermost cell of infobox | subheader = Subheader of the infobox | subheader2 = Second subheader of the infobox | header = (the rest of the infobox goes here) }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | name = {{subst:PAGENAME}} | above = Text in uppermost cell of infobox | subheader = Subheader of the infobox | subheader2 = Second subheader of the infobox | header = (the rest of the infobox goes here) }} </syntaxhighlight>{{clear}} === Illustration images === ; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text. ; caption(n) : Text to put underneath the images. === Main data === ; header(n) : Text to use as a header in row n. ; label(n) : Text to use as a label in row n. ; data(n) : Text to display as data in row n. Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are: * {{para|class''(n)''}} {{para|header''(n)''}} * {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}} * {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}} See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below. ==== Number ranges ==== To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example: <syntaxhighlight lang="wikitext" style="overflow:auto"> | header3 = Section 1 | label5 = Label A | data5 = Data A | label7 = Label C | data7 = Data C | header10 = Section 2 | label12 = Label D | data12 = Data D </syntaxhighlight>{{clear}} It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]]. There is no upper limit on numbers but there must be at most 50 between each used number. ==== Making data fields optional ==== A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so: <syntaxhighlight lang="wikitext" style="overflow:auto"> | label5 = Population | data5 = {{{population|}}} </syntaxhighlight>{{clear}} This way if an article doesn't define the population parameter in its infobox the row won't be displayed. For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'": <syntaxhighlight lang="wikitext" style="overflow:auto"> | label6 = Mass | data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }} </syntaxhighlight>{{clear}} For more on #if, see [[meta:ParserFunctions##if:|here]]. ==== Hiding headers when all its data fields are empty ==== You can also make headers automatically hide when their section is empty (has no data-row showing). Consider this situation: {{Infobox | title = Example: header with & without data | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Example: header with & without data | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} </syntaxhighlight>{{clear}} If you want hide the header when no {{para|data''N''}} values are present, use '''{{para|autoheaders|y}}''': {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} </syntaxhighlight>{{clear}} So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content. Note: if the data has empty css elements, like {{para|data|2=&lt;span style="background:yellow;">&lt;/span>}}, this will be treated as non-empty (having data). If {{para|autoheaders|y}} but there are items that you ''do not'' want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items. {{Infobox | title = Example: blank header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = _BLANK_ | label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5 }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = _BLANK_ | label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5 }} </syntaxhighlight>{{clear}} === Footer === ; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information. == Presentation parameters == === Italic titles === Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter. * Turn on italic titles by passing {{para|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox. * Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|<nowiki>{{{italic title|no}}}</nowiki>}} * Do not make any titles italic by not passing the parameter at all. === CSS styling === {{div col}} ; bodystyle : Applies to the infobox table as a whole ; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox. ; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle. ; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future. ; captionstyle : Applies to the text of the image caption. ; rowstyle(n) : This parameter is inserted into the <code>style</code> attribute for the specified row. ; headerstyle : Applies to all header cells ; subheaderstyle : Applies to all subheader cells ; labelstyle : Applies to all label cells ; datastyle : Applies to all data cells ; belowstyle : Applies only to the below cell {{div col end}} === HTML classes and microformats === {{div col}} ; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole. ; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption. <!-- currently not implemented in Lua module ; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on. --> ; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell. ; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on. ; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''. ; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on. ; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''. ; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells. ; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect. <!-- currently not implemented in Lua module ; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on. --> ; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell. {{div col end}} This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats. To flag an infobox as containing [[hCard]] information, for example, add the following parameter: <syntaxhighlight lang="wikitext" style="overflow:auto"> | bodyclass = vcard </syntaxhighlight>{{clear}} And for each row containing a data cell that's part of the vcard, add a corresponding class parameter: <syntaxhighlight lang="wikitext" style="overflow:auto"> | class1 = fn | class2 = org | class3 = tel </syntaxhighlight>{{clear}} ...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox. See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general. == Examples == Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell : {{Infobox |name = Infobox/doc |bodystyle = |titlestyle = |abovestyle = background:#cfc; |subheaderstyle = |title = Test Infobox |above = Above text |subheader = Subheader above image |subheader2 = Second subheader |imagestyle = |captionstyle = |image = [[File:Example-serious.jpg|200px|alt=Example alt text]] |caption = Caption displayed below File:Example-serious.jpg |headerstyle = background:#ccf; |labelstyle = background:#ddf; |datastyle = |header1 = Header defined alone | label1 = | data1 = |header2 = | label2 = Label defined alone does not display (needs data, or is suppressed) | data2 = |header3 = | label3 = | data3 = Data defined alone |header4 = All three defined (header, label, data, all with same number) | label4 = does not display (same number as a header) | data4 = does not display (same number as a header) |header5 = | label5 = Label and data defined (label) | data5 = Label and data defined (data) |belowstyle = background:#ddf; |below = Below text }} <syntaxhighlight lang="wikitext"> {{Infobox |name = Infobox/doc |bodystyle = |titlestyle = |abovestyle = background:#cfc; |subheaderstyle = |title = Test Infobox |above = Above text |subheader = Subheader above image |subheader2 = Second subheader |imagestyle = |captionstyle = |image = [[File:Example-serious.jpg|200px|alt=Example alt text]] |caption = Caption displayed below File:Example-serious.jpg |headerstyle = background:#ccf; |labelstyle = background:#ddf; |datastyle = |header1 = Header defined alone | label1 = | data1 = |header2 = | label2 = Label defined alone does not display (needs data, or is suppressed) | data2 = |header3 = | label3 = | data3 = Data defined alone |header4 = All three defined (header, label, data, all with same number) | label4 = does not display (same number as a header) | data4 = does not display (same number as a header) |header5 = | label5 = Label and data defined (label) | data5 = Label and data defined (data) |belowstyle = background:#ddf; |below = Below text }} </syntaxhighlight> For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels: {{Infobox |name = Infobox/doc |bodystyle = width:20em |titlestyle = |title = Test Infobox |headerstyle = |labelstyle = width:33% |datastyle = |header1 = | label1 = Label 1 | data1 = Data 1 |header2 = | label2 = Label 2 | data2 = Data 2 |header3 = | label3 = Label 3 | data3 = Data 3 |header4 = Header 4 | label4 = | data4 = |header5 = | label5 = Label 5 | data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |belowstyle = |below = Below text }} <syntaxhighlight lang="wikitext"> {{Infobox |name = Infobox/doc |bodystyle = width:20em |titlestyle = |title = Test Infobox |headerstyle = |labelstyle = width:33% |datastyle = |header1 = | label1 = Label 1 | data1 = Data 1 |header2 = | label2 = Label 2 | data2 = Data 2 |header3 = | label3 = Label 3 | data3 = Data 3 |header4 = Header 4 | label4 = | data4 = |header5 = | label5 = Label 5 | data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |belowstyle = |below = Below text }} </syntaxhighlight> == Embedding == <!--Linked from [[Template:Subinfobox bodystyle/doc]]--> One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>. {{Infobox | title = Top level title | data1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | data2 = {{Infobox | decat = yes | child = yes |title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Top level title | data1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | data2 = {{Infobox | decat = yes | child = yes |title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} </syntaxhighlight>{{clear}} Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using {{Infobox | title = Top level title | header1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | header2 = {{Infobox | decat = yes | child = yes | title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Top level title | header1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | header2 = {{Infobox | decat = yes | child = yes | title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} </syntaxhighlight>{{clear}} or, {{Infobox | title = Top level title | header1 = First subsection {{Infobox | decat = yes | child = yes | label1 = Label 1.1 | data1 = Data 1.1 }} | header2 = Second subsection {{Infobox | decat = yes | child = yes | label1 = Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Top level title | header1 = First subsection {{Infobox | decat = yes | child = yes | label1 = Label 1.1 | data1 = Data 1.1 }} | header2 = Second subsection {{Infobox | decat = yes | child = yes | label1 = Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} </syntaxhighlight>{{clear}} Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number. [[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes. == Subboxes == An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table. {{Infobox | headerstyle = background-color:#eee; | labelstyle = background-color:#eee; | header1 = Main 1 | header2 = Main 2 | data3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | data4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | label5 = Label 5 | data5 = Data 5 | header6 = Main 6 }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | headerstyle = background-color:#eee; | labelstyle = background-color:#eee; | header1 = Main 1 | header2 = Main 2 | data3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | data4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | label5 = Label 5 | data5 = Data 5 | header6 = Main 6 }} </syntaxhighlight>{{clear}} Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) : {{Sidebar | navbar = off | headingstyle = background-color:#eee; | heading1 = Heading 1 | heading2 = Heading 2 | content3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | content4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | heading5 = Heading 5 }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Sidebar | navbar = off | headingstyle = background-color:#eee; | heading1 = Heading 1 | heading2 = Heading 2 | content3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | content4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | heading5 = Heading 5 }} </syntaxhighlight>{{clear}} Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes. == Controlling line-breaking in embedded bulletless lists == Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details. == Full blank syntax == (Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.) <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | name = {{subst:PAGENAME}} | child = {{{child|}}} | subbox = {{{subbox|}}} | italic title = {{{italic title|no}}} | templatestyles = | child templatestyles = | grandchild templatestyles = | bodystyle = | titlestyle = | abovestyle = | subheaderstyle = | title = | above = | subheader = | imagestyle = | captionstyle = | image = | caption = | image2 = | caption2 = | headerstyle = | labelstyle = | datastyle = | header1 = | label1 = | data1 = | header2 = | label2 = | data2 = | header3 = | label3 = | data3 = | header4 = | label4 = | data4 = | header5 = | label5 = | data5 = | header6 = | label6 = | data6 = | header7 = | label7 = | data7 = | header8 = | label8 = | data8 = | header9 = | label9 = | data9 = | header10 = | label10 = | data10 = | header11 = | label11 = | data11 = | header12 = | label12 = | data12 = | header13 = | label13 = | data13 = | header14 = | label14 = | data14 = | header15 = | label15 = | data15 = | header16 = | label16 = | data16 = | header17 = | label17 = | data17 = | header18 = | label18 = | data18 = | header19 = | label19 = | data19 = | header20 = | label20 = | data20 = | belowstyle = | below = }} </syntaxhighlight>{{clear}} {{Help:Infobox/user style}} == Porting to other MediaWikis == The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] and [[:mw:Extension:TemplateStyles|TemplateStyles]] extensions. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis. == TemplateData == {{TemplateData header}} <templatedata> { "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.", "format": "{{_\n| ________________ = _\n}}\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true }, "image": { "label": "Image", "description": "Image illustrating the topic. Use full image syntax.", "type": "content", "suggested": true, "example": "[[File:example.png|200px|alt=Example alt text]]" }, "caption": { "label": "Caption", "description": "caption for the image", "type": "content", "suggested": true } }, "paramOrder": [ "title", "image", "caption" ] } </templatedata> ==Tracking categories== * {{Category link with count|Articles with missing Wikidata information}} * {{Category link with count|Articles using infobox templates with no data rows}} * {{Category link with count|Pages using embedded infobox templates with the title parameter}} ==See also== * [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based * [[Module:Check for unknown parameters]] * {{tl|Unstructured infobox}} * {{tl|Infobox3cols}} * {{tl|Navbox}} and {{tl|Sidebar}} * [[Wikipedia:List of infoboxes|List of infoboxes]] * [[:Module:InfoboxImage]] <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Infobox templates| ]] [[Category:Wikipedia metatemplates|Infobox]] [[Category:Templates generating microformats]] [[Category:Templates that add a tracking category]] [[Category:Templates based on the Infobox Lua module]] }}</includeonly> 8c47f082bd0a0c1ce81004d6651c34c61b7d2403 Module:Authority control 828 21 42 2023-07-18T10:01:56Z wikipedia>MSGJ 0 don't track empty state parameter as error, tweak to messages Scribunto text/plain require('strict') local p = {} local configfile = 'Module:Authority control/config' -- default configuation module local arg = mw.getCurrentFrame().args.config if arg and arg~='' then configfile = 'Module:Authority control/config/' .. arg end local config if mw.title.new(configfile).exists then config = mw.loadData(configfile) else return error('Invalid configuration file',0) end local title = mw.title.getCurrentTitle() local namespace = title.namespace local testcases = title.subpageText == config.i18n.testcases local function needsAttention(sortkey) return '[[' .. config.i18n.category .. ':' .. config.i18n.attentioncat .. '|' .. sortkey .. title.text .. ']]' end local function addCat(cat,sortkey) if cat and cat ~= '' and (namespace == 0 or namespace == 14 or testcases) then local redlinkcat = '' if testcases == false and mw.title.new(cat, 14).exists == false then redlinkcat = needsAttention('N') end if sortkey then cat = '[[' .. config.i18n.category .. ':'..cat..'|' .. sortkey .. title.text .. ']]' else cat = '[[' .. config.i18n.category .. ':'..cat..']]' end cat = cat .. redlinkcat return cat else return '' end end local function getCatForId(id,faulty) local cat = string.format( config.i18n.cat, (faulty and config.i18n.faulty..' ' or '') .. id ) return addCat(cat) end local function getIdsFromWikidata(qid,property) local function getquals(statement,qualid) if statement.qualifiers and statement.qualifiers['P'..qualid] then return mw.wikibase.renderSnak(statement.qualifiers['P'..qualid][1]) else return false end end local ids = {} if qid then for _, statement in ipairs(mw.wikibase.getBestStatements(qid,property)) do if statement.mainsnak.datavalue then local val = statement.mainsnak.datavalue.value if val then local namedas = getquals(statement,1810) or getquals(statement,742) or '' table.insert(ids,{id=val,name=namedas}) end end end end return ids end local _makelink = function(conf,val,nextid,qid) --validate values and create a link local function tooltip(text,label) if label and label~='' then return mw.getCurrentFrame():expandTemplate{title = "Tooltip", args = {text,label}} else return text end end local link if nextid==1 then if conf.prefix then link = '*' .. conf.prefix .. '\n**' else link = '*' end else link = '\n**' end local valid_value = false if conf.customlink then -- use function to validate and generate link local label = nextid>1 and nextid local newlink= require(config.auxiliary)[conf.customlink](val.id,label) if newlink then link = link .. newlink valid_value = true end else if conf.pattern then -- use pattern to determine validity if defined valid_value = string.match(val.id,'^'..conf.pattern..'$') elseif conf.patterns then for _,pattern in ipairs(conf.patterns) do valid_value = val.id:match('^'..pattern..'$') if valid_value then break end end elseif conf.valid then -- otherwise use function to determine validity valid_value = require(config.auxiliary)[conf.valid](val.id) else -- no validation possible valid_value = val.id end if valid_value then local newlink local label = conf.label if not label or nextid>1 then label = tostring(nextid) end if conf.link then valid_value = valid_value:gsub('%%', '%%%%') newlink = '[' .. mw.ustring.gsub(conf.link,'%$1',valid_value) .. ' ' .. label .. ']' else newlink = valid_value end link = link .. '<span class="uid">'..tooltip(newlink,val.name)..'</span>' end end if valid_value then link = link .. getCatForId(conf.category or conf[1]) else --local preview = require("Module:If preview") local wdlink = qid and '[[:wikidata:' .. qid .. '#P' .. conf.property .. ']]' or '' local tooltip = string.format( config.i18n.idnotvalid, conf[1], val.id ) link = link .. '[[File:' .. config.i18n.warningicon .. '|20px|frameless|link=' .. wdlink .. '|' .. tooltip .. '.]]' if conf.errorcat then link = link .. addCat(conf.errorcat) else link = link .. getCatForId(conf.category or conf[1],true) end link = link .. addCat(config.i18n.allfaultycat,conf[1])-- .. preview._warning({'The '..conf[1]..' id '..val..' is not valid.'}) end return link end --[[==========================================================================]] --[[ Main ]] --[[==========================================================================]] function p.authorityControl(frame) local function resolveQID(qid) if qid then qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '') if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) then local sitelink = mw.wikibase.getSitelink(qid) if sitelink then return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(qid).id end return mw.wikibase.getEntity(qid).id end end end local conf = config.config local parentArgs = frame:getParent().args local auxCats = '' local rct = false -- boolean to track if there are any links to be returned local qid,topic local wikilink = function(qid,hideifequal) local label,sitelink = mw.wikibase.getLabel(qid),mw.wikibase.getSitelink(qid) if label then if sitelink then local target = mw.title.new(sitelink) if target==title or (target.isRedirect and target.redirectTarget==title) then -- do not link return label else -- make wikilink to article return '[[' .. sitelink .. '|' .. label .. ']]' end else return label end else auxCats = auxCats .. needsAttention('L') return qid end end if namespace == 0 then qid = mw.wikibase.getEntityIdForCurrentPage() end if qid then -- article is connected to Wikidata item if parentArgs.qid and (resolveQID(parentArgs.qid) ~= qid) then -- non-matching qid parameter auxCats = auxCats .. needsAttention('D') end else -- page is not connected to any Wikidata item qid = resolveQID(parentArgs.qid) -- check qid parameter if no wikidata item is connected if qid then -- qid parameter is valid, set topic to display topic = mw.wikibase.getLabel(qid) if topic then if mw.ustring.lower(title.subpageText) == mw.ustring.lower(topic) then -- suppress topic display if subpagename equals topic up to case change topic = nil end if topic and mw.wikibase.getSitelink(qid) then -- make wikilink to article topic = '[[' .. mw.wikibase.getSitelink(qid) .. '|' .. topic .. ']]' end else auxCats = auxCats .. needsAttention('L') end elseif parentArgs.qid and parentArgs.qid~='' then -- invalid qid has been supplied, add to tracking cat auxCats = auxCats .. needsAttention('Q') end end local qids = {} -- setup any additional QIDs if parentArgs.additional=='auto' and qid then -- check P527 for parts to add additional qids local checkparts = function(property) local parts = mw.wikibase.getBestStatements(qid,property) if parts then for _,part in ipairs(parts) do if part.mainsnak.datavalue and part.mainsnak.datavalue.value.id then local resolvedqid = resolveQID(part.mainsnak.datavalue.value.id) if resolvedqid then table.insert(qids,resolvedqid) end end end end end for _,part in ipairs(config.auto_additional) do checkparts('P'..tostring(part)) end elseif parentArgs.additional and parentArgs.additional ~= '' then for _,v in ipairs(mw.text.split(parentArgs.additional,"%s*,%s*")) do v = resolveQID(v) if v then if v == qid then -- duplicate of qid parameter auxCats = auxCats .. needsAttention('R') end table.insert(qids,v) else -- invalid QID specified auxCats = auxCats .. needsAttention('A') end end end local sections = {} local localparams = false local numsections = 0 for _,_ in ipairs(config.sections) do numsections = numsections + 1 end for _ = 1,#qids+numsections do table.insert(sections,{}) end local qslink = '' -- setup link to add using QuickStatements -- check which identifiers to show/suppress in template local show = {} -- setup list local showall = true local function stripP(pid) if pid:match("^[Pp]%d+$") then pid = mw.ustring.gsub(pid,'[Pp]','') --strip P from property number end if pid:match("^%d+$") then return tonumber(pid) end end local function addshowlist(list) if list and list ~= '' then for _,v in ipairs(mw.text.split(string.lower(list),"%s*,%s*")) do local vprop = stripP(v) if vprop then -- e.g. show=P214 to show one particular property show[vprop] = true else -- e.g. show=arts to use whitelist if config.whitelists[v] then for _,w in ipairs(config.whitelists[v].properties) do show[w] = true end end end end showall = false end end addshowlist(frame.args.show) -- check show= parameter on wrapper template addshowlist(parentArgs.show or parentArgs.country) -- check show parameter on article template if parentArgs.suppress then local suppresslist = mw.text.split(parentArgs.suppress,"%s*,%s*") -- split parameter by comma for _,v in ipairs(suppresslist) do v = stripP(string.upper(v)) if v then show[v] = false auxCats = auxCats .. '[[' .. config.i18n.category .. ':' .. config.i18n.suppressedcat .. ']]' else auxCats = auxCats .. needsAttention('P') end end end local function makeSections(qid,addit) local tval = {} local function parameter_is_used(property) local used = false if property then if tval[property] then if tval[property][1] then used = true end elseif tval[property] == false then -- property has been manually suppressed used = true end end return used end for _, params in ipairs(conf) do tval[params.property] = getIdsFromWikidata(qid, 'P' .. params.property) -- setup table for values with property number as key local showb = true if (show[params.property] == nil) and (show[string.upper(params[1])] == nil ) then showb = showall -- if not specified then depends on showall elseif (show[params.property] == false) or (show[string.upper(params[1])] == false) then -- if either are false then id will be suppressed showb = false end if not showb then tval[params.property] = false -- indicates the identifier is suppressed elseif not addit then local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]] if val and val~='' then -- add local parameter to list if not already in localparams = true local bnew = true for _, w in pairs(tval[params.property]) do if val == w.id then bnew = false end end if bnew then -- add new value to table if qid then qslink = qslink .. '%7C%7C' .. qid .. '%7CP' .. params.property .. '%7C%22' .. mw.uri.encode(val,"PATH") .. '%22%7CS143%7CQ328' end table.insert(tval[params.property],{id=val,name=''}) end end end local suppress = false if params.suppressedbyproperty then for _,sc in ipairs(params.suppressedbyproperty) do if parameter_is_used(sc) then suppress = true end end end if tval[params.property] ~= false and not suppress then local tlinks = {} -- setup table for links local nextIdVal = 1 local row = '' for _,val in ipairs(tval[params.property]) do local link = _makelink(params,val,nextIdVal,qid) row = row .. link table.insert(tlinks,link) nextIdVal = nextIdVal + 1 end if nextIdVal>=2 then row = row .. '\n' table.insert(sections[addit or params.section],row) rct = true end end end end local function pencil(qid) if not qid then return '' end local args = { pid = 'identifiers' } -- #target the list of identifiers args.qid = qid return require('Module:EditAtWikidata')._showMessage(args) end makeSections(qid,false) for c = 1,#qids do makeSections(qids[c],numsections+c) end --configure Navbox local outString = '' if rct or localparams then -- there is at least one link to display local Navbox = require('Module:Navbox') local sect,lastsect = 0,0 local navboxArgs = { name = 'Authority control', navboxclass = 'authority-control', bodyclass = 'hlist', state = parentArgs.state or config.i18n.autocollapse, navbar = 'off' } for c=1,numsections+#qids do if #sections[c] ~= 0 then -- section is non-empty sect = sect + 1 lastsect = c local sectname if c <= numsections then -- regular section sectname = config.sections[c].name else -- section from additional qid local qid = qids[c-numsections] sectname = wikilink(qid) .. pencil(qid) end navboxArgs['group' .. c] = sectname navboxArgs['list' .. c] = table.concat(sections[c]) end end if localparams then lastsect = lastsect + 1 sect = sect + 1 navboxArgs['group' .. lastsect] = config.i18n.warning local warning = frame:expandTemplate{title = config.i18n.errortemplate, args = {config.i18n.localparams}} if qslink ~= '' then warning = warning .. ' ' .. config.i18n.movetowd .. '<span class="qs autoconfirmed-show">&#32;[[File:Commons to Wikidata QuickStatements.svg|20px|link=https://quickstatements.toolforge.org/#/v1=' .. qslink .. '|' .. config.i18n.addtowd .. ']]</span>' elseif not qid then if namespace == 0 then warning = warning .. ' ' .. config.i18n.connecttowd elseif namespace==14 or namespace==2 or namespace==118 then warning = warning .. ' ' .. config.i18n.qidcode end end navboxArgs['list' .. lastsect] = warning end if topic then -- display in expanded form with topic navboxArgs.title = config.i18n.aclink .. ' &ndash; ' .. topic .. pencil(qid) elseif sect == 1 then -- special display when only one section if lastsect <= numsections then if config.sections[lastsect].hidelabelwhenalone then -- no special label when only general or other IDs are present navboxArgs['group' .. lastsect] = config.i18n.aclink .. pencil(qid) else -- other regular section navboxArgs['group' .. lastsect] = config.i18n.aclink .. ': ' .. navboxArgs['group' .. lastsect] .. pencil(qid) end else -- section from additional qid navboxArgs['group' .. lastsect] = config.i18n.aclink .. ': ' .. navboxArgs['group' .. lastsect] end else -- add title to navbox navboxArgs.title = config.i18n.aclink .. pencil(qid) end outString = Navbox._navbox(navboxArgs) end if parentArgs.state and parentArgs.state~='' and parentArgs.state~=config.i18n.collapsed and parentArgs.state~=config.i18n.expanded and parentArgs.state~=config.i18n.autocollapse then --invalid state parameter auxCats = auxCats .. needsAttention('S') end if testcases then auxCats = mw.ustring.gsub(auxCats, '(%[%[)(' .. config.i18n.category .. ')', '%1:%2') --for easier checking end --out outString = outString..auxCats if namespace ~= 0 then outString = mw.ustring.gsub(outString,'(%[%[)(' .. config.i18n.category .. ':' .. config.i18n.Articles .. ')([^%|%]]+)%|?[^%|%]]*(%]%])','%1:%2%3%4') outString = mw.ustring.gsub(outString,'(%[%[)(' .. config.i18n.category .. ':' .. config.i18n.All_articles .. ')([^%|%]]+)%|?[^%|%]]*(%]%])','%1:%2%3%4') end local check = require('Module:Check for unknown parameters')._check local sortkey if namespace == 0 then sortkey = '*' .. title.text else sortkey = title.fullText end outString = outString .. check({ ['unknown'] = '[[' .. config.i18n.category .. ':' .. config.i18n.pageswithparams .. '|' .. sortkey .. ']]', ['preview'] = config.i18n.previewwarning, 'show', 'country', 'suppress', 'additional', 'qid', 'state' }, parentArgs) return outString end p.makelink = function(conf,val,nextid,qid) return _makelink(conf,val,nextid,qid) end return p 53aaca83d7c22230cefa966b7911d2ab311588a9 43 42 2023-08-02T22:42:12Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain require('strict') local p = {} local configfile = 'Module:Authority control/config' -- default configuation module local arg = mw.getCurrentFrame().args.config if arg and arg~='' then configfile = 'Module:Authority control/config/' .. arg end local config if mw.title.new(configfile).exists then config = mw.loadData(configfile) else return error('Invalid configuration file',0) end local title = mw.title.getCurrentTitle() local namespace = title.namespace local testcases = title.subpageText == config.i18n.testcases local function needsAttention(sortkey) return '[[' .. config.i18n.category .. ':' .. config.i18n.attentioncat .. '|' .. sortkey .. title.text .. ']]' end local function addCat(cat,sortkey) if cat and cat ~= '' and (namespace == 0 or namespace == 14 or testcases) then local redlinkcat = '' if testcases == false and mw.title.new(cat, 14).exists == false then redlinkcat = needsAttention('N') end if sortkey then cat = '[[' .. config.i18n.category .. ':'..cat..'|' .. sortkey .. title.text .. ']]' else cat = '[[' .. config.i18n.category .. ':'..cat..']]' end cat = cat .. redlinkcat return cat else return '' end end local function getCatForId(id,faulty) local cat = string.format( config.i18n.cat, (faulty and config.i18n.faulty..' ' or '') .. id ) return addCat(cat) end local function getIdsFromWikidata(qid,property) local function getquals(statement,qualid) if statement.qualifiers and statement.qualifiers['P'..qualid] then return mw.wikibase.renderSnak(statement.qualifiers['P'..qualid][1]) else return false end end local ids = {} if qid then for _, statement in ipairs(mw.wikibase.getBestStatements(qid,property)) do if statement.mainsnak.datavalue then local val = statement.mainsnak.datavalue.value if val then local namedas = getquals(statement,1810) or getquals(statement,742) or '' table.insert(ids,{id=val,name=namedas}) end end end end return ids end local _makelink = function(conf,val,nextid,qid) --validate values and create a link local function tooltip(text,label) if label and label~='' then return mw.getCurrentFrame():expandTemplate{title = "Tooltip", args = {text,label}} else return text end end local link if nextid==1 then if conf.prefix then link = '*' .. conf.prefix .. '\n**' else link = '*' end else link = '\n**' end local valid_value = false if conf.customlink then -- use function to validate and generate link local label = nextid>1 and nextid local newlink= require(config.auxiliary)[conf.customlink](val.id,label) if newlink then link = link .. newlink valid_value = true end else if conf.pattern then -- use pattern to determine validity if defined valid_value = string.match(val.id,'^'..conf.pattern..'$') elseif conf.patterns then for _,pattern in ipairs(conf.patterns) do valid_value = val.id:match('^'..pattern..'$') if valid_value then break end end elseif conf.valid then -- otherwise use function to determine validity valid_value = require(config.auxiliary)[conf.valid](val.id) else -- no validation possible valid_value = val.id end if valid_value then local newlink local label = conf.label if not label or nextid>1 then label = tostring(nextid) end if conf.link then valid_value = valid_value:gsub('%%', '%%%%') newlink = '[' .. mw.ustring.gsub(conf.link,'%$1',valid_value) .. ' ' .. label .. ']' else newlink = valid_value end link = link .. '<span class="uid">'..tooltip(newlink,val.name)..'</span>' end end if valid_value then link = link .. getCatForId(conf.category or conf[1]) else --local preview = require("Module:If preview") local wdlink = qid and '[[:wikidata:' .. qid .. '#P' .. conf.property .. ']]' or '' local tooltip = string.format( config.i18n.idnotvalid, conf[1], val.id ) link = link .. '[[File:' .. config.i18n.warningicon .. '|20px|frameless|link=' .. wdlink .. '|' .. tooltip .. '.]]' if conf.errorcat then link = link .. addCat(conf.errorcat) else link = link .. getCatForId(conf.category or conf[1],true) end link = link .. addCat(config.i18n.allfaultycat,conf[1])-- .. preview._warning({'The '..conf[1]..' id '..val..' is not valid.'}) end return link end --[[==========================================================================]] --[[ Main ]] --[[==========================================================================]] function p.authorityControl(frame) local function resolveQID(qid) if qid then qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '') if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) then local sitelink = mw.wikibase.getSitelink(qid) if sitelink then return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(qid).id end return mw.wikibase.getEntity(qid).id end end end local conf = config.config local parentArgs = frame:getParent().args local auxCats = '' local rct = false -- boolean to track if there are any links to be returned local qid,topic local wikilink = function(qid,hideifequal) local label,sitelink = mw.wikibase.getLabel(qid),mw.wikibase.getSitelink(qid) if label then if sitelink then local target = mw.title.new(sitelink) if target==title or (target.isRedirect and target.redirectTarget==title) then -- do not link return label else -- make wikilink to article return '[[' .. sitelink .. '|' .. label .. ']]' end else return label end else auxCats = auxCats .. needsAttention('L') return qid end end if namespace == 0 then qid = mw.wikibase.getEntityIdForCurrentPage() end if qid then -- article is connected to Wikidata item if parentArgs.qid and (resolveQID(parentArgs.qid) ~= qid) then -- non-matching qid parameter auxCats = auxCats .. needsAttention('D') end else -- page is not connected to any Wikidata item qid = resolveQID(parentArgs.qid) -- check qid parameter if no wikidata item is connected if qid then -- qid parameter is valid, set topic to display topic = mw.wikibase.getLabel(qid) if topic then if mw.ustring.lower(title.subpageText) == mw.ustring.lower(topic) then -- suppress topic display if subpagename equals topic up to case change topic = nil end if topic and mw.wikibase.getSitelink(qid) then -- make wikilink to article topic = '[[' .. mw.wikibase.getSitelink(qid) .. '|' .. topic .. ']]' end else auxCats = auxCats .. needsAttention('L') end elseif parentArgs.qid and parentArgs.qid~='' then -- invalid qid has been supplied, add to tracking cat auxCats = auxCats .. needsAttention('Q') end end local qids = {} -- setup any additional QIDs if parentArgs.additional=='auto' and qid then -- check P527 for parts to add additional qids local checkparts = function(property) local parts = mw.wikibase.getBestStatements(qid,property) if parts then for _,part in ipairs(parts) do if part.mainsnak.datavalue and part.mainsnak.datavalue.value.id then local resolvedqid = resolveQID(part.mainsnak.datavalue.value.id) if resolvedqid then table.insert(qids,resolvedqid) end end end end end for _,part in ipairs(config.auto_additional) do checkparts('P'..tostring(part)) end elseif parentArgs.additional and parentArgs.additional ~= '' then for _,v in ipairs(mw.text.split(parentArgs.additional,"%s*,%s*")) do v = resolveQID(v) if v then if v == qid then -- duplicate of qid parameter auxCats = auxCats .. needsAttention('R') end table.insert(qids,v) else -- invalid QID specified auxCats = auxCats .. needsAttention('A') end end end local sections = {} local localparams = false local numsections = 0 for _,_ in ipairs(config.sections) do numsections = numsections + 1 end for _ = 1,#qids+numsections do table.insert(sections,{}) end local qslink = '' -- setup link to add using QuickStatements -- check which identifiers to show/suppress in template local show = {} -- setup list local showall = true local function stripP(pid) if pid:match("^[Pp]%d+$") then pid = mw.ustring.gsub(pid,'[Pp]','') --strip P from property number end if pid:match("^%d+$") then return tonumber(pid) end end local function addshowlist(list) if list and list ~= '' then for _,v in ipairs(mw.text.split(string.lower(list),"%s*,%s*")) do local vprop = stripP(v) if vprop then -- e.g. show=P214 to show one particular property show[vprop] = true else -- e.g. show=arts to use whitelist if config.whitelists[v] then for _,w in ipairs(config.whitelists[v].properties) do show[w] = true end end end end showall = false end end addshowlist(frame.args.show) -- check show= parameter on wrapper template addshowlist(parentArgs.show or parentArgs.country) -- check show parameter on article template if parentArgs.suppress then local suppresslist = mw.text.split(parentArgs.suppress,"%s*,%s*") -- split parameter by comma for _,v in ipairs(suppresslist) do v = stripP(string.upper(v)) if v then show[v] = false auxCats = auxCats .. '[[' .. config.i18n.category .. ':' .. config.i18n.suppressedcat .. ']]' else auxCats = auxCats .. needsAttention('P') end end end local function makeSections(qid,addit) local tval = {} local function parameter_is_used(property) local used = false if property then if tval[property] then if tval[property][1] then used = true end elseif tval[property] == false then -- property has been manually suppressed used = true end end return used end for _, params in ipairs(conf) do tval[params.property] = getIdsFromWikidata(qid, 'P' .. params.property) -- setup table for values with property number as key local showb = true if (show[params.property] == nil) and (show[string.upper(params[1])] == nil ) then showb = showall -- if not specified then depends on showall elseif (show[params.property] == false) or (show[string.upper(params[1])] == false) then -- if either are false then id will be suppressed showb = false end if not showb then tval[params.property] = false -- indicates the identifier is suppressed elseif not addit then local val = parentArgs[mw.ustring.lower(params[1])] or parentArgs[params[1]] if val and val~='' then -- add local parameter to list if not already in localparams = true local bnew = true for _, w in pairs(tval[params.property]) do if val == w.id then bnew = false end end if bnew then -- add new value to table if qid then qslink = qslink .. '%7C%7C' .. qid .. '%7CP' .. params.property .. '%7C%22' .. mw.uri.encode(val,"PATH") .. '%22%7CS143%7CQ328' end table.insert(tval[params.property],{id=val,name=''}) end end end local suppress = false if params.suppressedbyproperty then for _,sc in ipairs(params.suppressedbyproperty) do if parameter_is_used(sc) then suppress = true end end end if tval[params.property] ~= false and not suppress then local tlinks = {} -- setup table for links local nextIdVal = 1 local row = '' for _,val in ipairs(tval[params.property]) do local link = _makelink(params,val,nextIdVal,qid) row = row .. link table.insert(tlinks,link) nextIdVal = nextIdVal + 1 end if nextIdVal>=2 then row = row .. '\n' table.insert(sections[addit or params.section],row) rct = true end end end end local function pencil(qid) if not qid then return '' end local args = { pid = 'identifiers' } -- #target the list of identifiers args.qid = qid return require('Module:EditAtWikidata')._showMessage(args) end makeSections(qid,false) for c = 1,#qids do makeSections(qids[c],numsections+c) end --configure Navbox local outString = '' if rct or localparams then -- there is at least one link to display local Navbox = require('Module:Navbox') local sect,lastsect = 0,0 local navboxArgs = { name = 'Authority control', navboxclass = 'authority-control', bodyclass = 'hlist', state = parentArgs.state or config.i18n.autocollapse, navbar = 'off' } for c=1,numsections+#qids do if #sections[c] ~= 0 then -- section is non-empty sect = sect + 1 lastsect = c local sectname if c <= numsections then -- regular section sectname = config.sections[c].name else -- section from additional qid local qid = qids[c-numsections] sectname = wikilink(qid) .. pencil(qid) end navboxArgs['group' .. c] = sectname navboxArgs['list' .. c] = table.concat(sections[c]) end end if localparams then lastsect = lastsect + 1 sect = sect + 1 navboxArgs['group' .. lastsect] = config.i18n.warning local warning = frame:expandTemplate{title = config.i18n.errortemplate, args = {config.i18n.localparams}} if qslink ~= '' then warning = warning .. ' ' .. config.i18n.movetowd .. '<span class="qs autoconfirmed-show">&#32;[[File:Commons to Wikidata QuickStatements.svg|20px|link=https://quickstatements.toolforge.org/#/v1=' .. qslink .. '|' .. config.i18n.addtowd .. ']]</span>' elseif not qid then if namespace == 0 then warning = warning .. ' ' .. config.i18n.connecttowd elseif namespace==14 or namespace==2 or namespace==118 then warning = warning .. ' ' .. config.i18n.qidcode end end navboxArgs['list' .. lastsect] = warning end if topic then -- display in expanded form with topic navboxArgs.title = config.i18n.aclink .. ' &ndash; ' .. topic .. pencil(qid) elseif sect == 1 then -- special display when only one section if lastsect <= numsections then if config.sections[lastsect].hidelabelwhenalone then -- no special label when only general or other IDs are present navboxArgs['group' .. lastsect] = config.i18n.aclink .. pencil(qid) else -- other regular section navboxArgs['group' .. lastsect] = config.i18n.aclink .. ': ' .. navboxArgs['group' .. lastsect] .. pencil(qid) end else -- section from additional qid navboxArgs['group' .. lastsect] = config.i18n.aclink .. ': ' .. navboxArgs['group' .. lastsect] end else -- add title to navbox navboxArgs.title = config.i18n.aclink .. pencil(qid) end outString = Navbox._navbox(navboxArgs) end if parentArgs.state and parentArgs.state~='' and parentArgs.state~=config.i18n.collapsed and parentArgs.state~=config.i18n.expanded and parentArgs.state~=config.i18n.autocollapse then --invalid state parameter auxCats = auxCats .. needsAttention('S') end if testcases then auxCats = mw.ustring.gsub(auxCats, '(%[%[)(' .. config.i18n.category .. ')', '%1:%2') --for easier checking end --out outString = outString..auxCats if namespace ~= 0 then outString = mw.ustring.gsub(outString,'(%[%[)(' .. config.i18n.category .. ':' .. config.i18n.Articles .. ')([^%|%]]+)%|?[^%|%]]*(%]%])','%1:%2%3%4') outString = mw.ustring.gsub(outString,'(%[%[)(' .. config.i18n.category .. ':' .. config.i18n.All_articles .. ')([^%|%]]+)%|?[^%|%]]*(%]%])','%1:%2%3%4') end local check = require('Module:Check for unknown parameters')._check local sortkey if namespace == 0 then sortkey = '*' .. title.text else sortkey = title.fullText end outString = outString .. check({ ['unknown'] = '[[' .. config.i18n.category .. ':' .. config.i18n.pageswithparams .. '|' .. sortkey .. ']]', ['preview'] = config.i18n.previewwarning, 'show', 'country', 'suppress', 'additional', 'qid', 'state' }, parentArgs) return outString end p.makelink = function(conf,val,nextid,qid) return _makelink(conf,val,nextid,qid) end return p 53aaca83d7c22230cefa966b7911d2ab311588a9 Template:Infobox settlement/doc 10 27 54 2023-07-21T06:05:37Z wikipedia>Paine Ellsworth 0 High-use template wikitext text/x-wiki {{Documentation subpage}} <!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])--> {{Auto short description}} {{High-use}} {{Lua|Module:Infobox|Module:InfoboxImage|Module:Coordinates|Module:Check for unknown parameters|Module:Settlement short description}} {{Uses TemplateStyles|Template:Infobox settlement/styles.css}} {{Uses Wikidata|P41|P94|P158|P625|P856}} This template should be used to produce an [[WP:Infobox|Infobox]] for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, et cetera—in fact, any subdivision below the level of a country, for which {{tl|Infobox country}} should be used. Parameters are described in the table below. For questions, see the [[Template talk:Infobox settlement|talk page]]. For a US city guideline, see [[WP:USCITIES]]. The template is aliased or used as a sub-template for several infobox front-end templates. ==Usage== * '''Important''': Please enter all numeric values in a raw, unformatted fashion. References and {{tl|citation needed}} tags are to be included in their respective section footnotes field. Numeric values that are not "raw" may create an "Expression error". Raw values will be automatically formatted by the template. If you find a raw value is not formatted in your usage of the template, please post a notice on the discussion page for this template. * An expression error may also occur when any coordinate parameter has a value, but one or more coordinate parameters are blank or invalid. Basic blank template, ready to cut and paste. See the next section for a copy of the template with all parameters and comments. See the table below that for a full description of each parameter. ===Using metric units=== <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox settlement |name = |native_name = <!-- Settlement name in local language(s), if different from the English name --> |native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> |settlement_type = |image_skyline = |imagesize = |image_alt = |image_caption = |image_flag = |flag_alt = |image_seal = |seal_alt = |image_shield = |shield_alt = |etymology = |nickname = |motto = |image_map = |map_alt = |map_caption = |pushpin_map = |pushpin_map_alt = |pushpin_map_caption = |pushpin_mapsize = |pushpin_label_position = |coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} --> |coor_pinpoint = |coordinates_footnotes = |subdivision_type = Country |subdivision_name = |subdivision_type1 = |subdivision_name1 = |subdivision_type2 = |subdivision_name2 = |subdivision_type3 = |subdivision_name3 = |established_title = |established_date = |founder = |seat_type = |seat = |government_footnotes = |government_type = |governing_body = |leader_party = |leader_title = |leader_name = |leader_title1 = |leader_name1 = |leader_title2 = |leader_name2 = |leader_title3 = |leader_name3 = |leader_title4 = |leader_name4 = |unit_pref = Metric <!-- ALL fields with measurements have automatic unit conversion --> <!-- for references: use <ref> tags --> |area_footnotes = |area_urban_footnotes = <!-- <ref> </ref> --> |area_rural_footnotes = <!-- <ref> </ref> --> |area_metro_footnotes = <!-- <ref> </ref> --> |area_note = |area_water_percent = |area_rank = |area_blank1_title = |area_blank2_title = <!-- square kilometers --> |area_total_km2 = |area_land_km2 = |area_water_km2 = |area_urban_km2 = |area_rural_km2 = |area_metro_km2 = |area_blank1_km2 = |area_blank2_km2 = <!-- hectares --> |area_total_ha = |area_land_ha = |area_water_ha = |area_urban_ha = |area_rural_ha = |area_metro_ha = |area_blank1_ha = |area_blank2_ha = |length_km = |width_km = |dimensions_footnotes = |elevation_footnotes = |elevation_m = |population_footnotes = |population_as_of = |population_total = |population_density_km2 = auto |population_note = |population_demonym = |timezone1 = |utc_offset1 = |timezone1_DST = |utc_offset1_DST = |postal_code_type = |postal_code = |area_code_type = |area_code = |area_codes = <!-- for multiple area codes --> |iso_code = |website = <!-- {{URL|example.com}} --> |module = |footnotes = }} </syntaxhighlight> ===Using non-metric units=== <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox settlement |name = |native_name = |native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> |settlement_type = |image_skyline = |imagesize = |image_alt = |image_caption = |image_flag = |flag_alt = |image_seal = |seal_alt = |image_shield = |shield_alt = |etymology = |nickname = |motto = |image_map = |map_alt = |map_caption = |pushpin_map = |pushpin_map_alt = |pushpin_map_caption = |pushpin_label_position = |coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} --> |coor_pinpoint = |coordinates_footnotes = |subdivision_type = Country |subdivision_name = |subdivision_type1 = |subdivision_name1 = |subdivision_type2 = |subdivision_name2 = |subdivision_type3 = |subdivision_name3 = |established_title = |established_date = |founder = |seat_type = |seat = |government_footnotes = |leader_party = |leader_title = |leader_name = |unit_pref = US<!-- or UK --> <!-- ALL fields with measurements have automatic unit conversion --> <!-- for references: use <ref> tags --> |area_footnotes = |area_urban_footnotes = <!-- <ref> </ref> --> |area_rural_footnotes = <!-- <ref> </ref> --> |area_metro_footnotes = <!-- <ref> </ref> --> |area_note = |area_water_percent = |area_rank = |area_blank1_title = |area_blank2_title = <!-- square miles --> |area_total_sq_mi = |area_land_sq_mi = |area_water_sq_mi = |area_urban_sq_mi = |area_rural_sq_mi = |area_metro_sq_mi = |area_blank1_sq_mi = |area_blank2_sq_mi = <!-- acres --> |area_total_acre = |area_land_acre = |area_water_acre = |area_urban_acre = |area_rural_acre = |area_metro_acre = |area_blank1_acre = |area_blank2_acre = |length_mi = |width_mi = |dimensions_footnotes = |elevation_footnotes = |elevation_ft = |population_footnotes = |population_as_of = |population_total = |population_density_sq_mi = auto |population_note = |population_demonym = |timezone1 = |utc_offset1 = |timezone1_DST = |utc_offset1_DST = |postal_code_type = |postal_code = |area_code_type = |area_code = |iso_code = |website = <!-- {{URL|example.com}} --> |module = |footnotes = }} </syntaxhighlight> ===Short version=== <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox settlement |name = |native_name = |native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> |settlement_type = |image_skyline = |imagesize = |image_alt = |image_caption = |etymology = |nickname = |coordinates = <!-- {{Coord}} --> |population_total = |subdivision_type = Country |subdivision_name = |subdivision_type1 = |subdivision_name1 = |subdivision_type2 = |subdivision_name2 = |website = <!-- {{URL|example.com}} --> }} </syntaxhighlight> ===Complete empty syntax, with comments=== This copy of the template lists all parameters except for some of the repeating numbered parameters which are noted in the comments. Comments here should be brief; see the table below for full descriptions of each parameter. <syntaxhighlight lang="wikitext" style="overflow:auto;"> {{Infobox settlement | name = <!-- at least one of the first two fields must be filled in --> | official_name = | native_name = <!-- if different from the English name --> | native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> | other_name = | settlement_type = <!-- such as Town, Village, City, Borough etc. --> <!-- transliteration(s) --> | translit_lang1 = | translit_lang1_type = | translit_lang1_info = | translit_lang1_type1 = | translit_lang1_info1 = | translit_lang1_type2 = | translit_lang1_info2 = <!-- etc., up to translit_lang1_type6 / translit_lang1_info6 --> | translit_lang2 = | translit_lang2_type = | translit_lang2_info = | translit_lang2_type1 = | translit_lang2_info1 = | translit_lang2_type2 = | translit_lang2_info2 = <!-- etc., up to translit_lang2_type6 / translit_lang2_info6 --> <!-- images, nickname, motto --> | image_skyline = | imagesize = | image_alt = | image_caption = | image_flag = | flag_size = | flag_alt = | flag_border = | flag_link = | image_seal = | seal_size = | seal_alt = | seal_link = | seal_type = | image_shield = | shield_size = | shield_alt = | shield_link = | image_blank_emblem = | blank_emblem_type = | blank_emblem_size = | blank_emblem_alt = | blank_emblem_link = | etymology = | nickname = | nicknames = | motto = | mottoes = | anthem = <!-- maps and coordinates --> | image_map = | mapsize = | map_alt = | map_caption = | image_map1 = | mapsize1 = | map_alt1 = | map_caption1 = | pushpin_map = <!-- name of a location map as per Template:Location_map --> | pushpin_mapsize = | pushpin_map_alt = | pushpin_map_caption = | pushpin_map_caption_notsmall = | pushpin_label = <!-- only necessary if "name" or "official_name" are too long --> | pushpin_label_position = <!-- position of the pushpin label: left, right, top, bottom, none --> | pushpin_outside = | pushpin_relief = | pushpin_image = | pushpin_overlay = | coordinates = <!-- {{Coord}} --> | coor_pinpoint = <!-- to specify exact location of coordinates (was coor_type) --> | coordinates_footnotes = <!-- for references: use <ref> tags --> | grid_name = <!-- name of a regional grid system --> | grid_position = <!-- position on the regional grid system --> <!-- location --> | subdivision_type = Country | subdivision_name = <!-- the name of the country --> | subdivision_type1 = | subdivision_name1 = | subdivision_type2 = | subdivision_name2 = <!-- etc., subdivision_type6 / subdivision_name6 --> <!-- established --> | established_title = <!-- Founded --> | established_date = <!-- requires established_title= --> | established_title1 = <!-- Incorporated (town) --> | established_date1 = <!-- requires established_title1= --> | established_title2 = <!-- Incorporated (city) --> | established_date2 = <!-- requires established_title2= --> | established_title3 = | established_date3 = <!-- requires established_title3= --> | established_title4 = | established_date4 = <!-- requires established_title4= --> | established_title5 = | established_date5 = <!-- requires established_title5= --> | established_title6 = | established_date6 = <!-- requires established_title6= --> | established_title7 = | established_date7 = <!-- requires established_title7= --> | extinct_title = | extinct_date = | founder = | named_for = <!-- seat, smaller parts --> | seat_type = <!-- defaults to: Seat --> | seat = | seat1_type = <!-- defaults to: Former seat --> | seat1 = | parts_type = <!-- defaults to: Boroughs --> | parts_style = <!-- list, coll (collapsed list), para (paragraph format) --> | parts = <!-- parts text, or header for parts list --> | p1 = | p2 = <!-- etc., up to p50: for separate parts to be listed--> <!-- government type, leaders --> | government_footnotes = <!-- for references: use <ref> tags --> | government_type = | governing_body = | leader_party = | leader_title = | leader_name = <!-- add &amp;nbsp; (no-break space) to disable automatic links --> | leader_title1 = | leader_name1 = <!-- etc., up to leader_title4 / leader_name4 --> <!-- display settings --> | total_type = <!-- to set a non-standard label for total area and population rows --> | unit_pref = <!-- enter: Imperial, to display imperial before metric --> <!-- area --> | area_footnotes = <!-- for references: use <ref> tags --> | dunam_link = <!-- If dunams are used, this specifies which dunam to link. --> | area_total_km2 = <!-- ALL fields with measurements have automatic unit conversion --> | area_total_sq_mi = <!-- see table @ Template:Infobox settlement for details --> | area_total_ha = | area_total_acre = | area_total_dunam = <!-- used in Middle East articles only --> | area_land_km2 = | area_land_sq_mi = | area_land_ha = | area_land_acre = | area_land_dunam = <!-- used in Middle East articles only --> | area_water_km2 = | area_water_sq_mi = | area_water_ha = | area_water_acre = | area_water_dunam = <!-- used in Middle East articles only --> | area_water_percent = | area_urban_footnotes = <!-- for references: use <ref> tags --> | area_urban_km2 = | area_urban_sq_mi = | area_urban_ha = | area_urban_acre = | area_urban_dunam = <!-- used in Middle East articles only --> | area_rural_footnotes = <!-- for references: use <ref> tags --> | area_rural_km2 = | area_rural_sq_mi = | area_rural_ha = | area_rural_acre = | area_rural_dunam = <!-- used in Middle East articles only --> | area_metro_footnotes = <!-- for references: use <ref> tags --> | area_metro_km2 = | area_metro_sq_mi = | area_metro_ha = | area_metro_acre = | area_metro_dunam = <!-- used in Middle East articles only --> | area_rank = | area_blank1_title = | area_blank1_km2 = | area_blank1_sq_mi = | area_blank1_ha = | area_blank1_acre = | area_blank1_dunam = <!-- used in Middle East articles only --> | area_blank2_title = | area_blank2_km2 = | area_blank2_sq_mi = | area_blank2_ha = | area_blank2_acre = | area_blank2_dunam = <!-- used in Middle East articles only --> | area_note = <!-- dimensions --> | dimensions_footnotes = <!-- for references: use <ref> tags --> | length_km = | length_mi = | width_km = | width_mi = <!-- elevation --> | elevation_footnotes = <!-- for references: use <ref> tags --> | elevation_m = | elevation_ft = | elevation_point = <!-- for denoting the measurement point --> | elevation_max_footnotes = <!-- for references: use <ref> tags --> | elevation_max_m = | elevation_max_ft = | elevation_max_point = <!-- for denoting the measurement point --> | elevation_max_rank = | elevation_min_footnotes = <!-- for references: use <ref> tags --> | elevation_min_m = | elevation_min_ft = | elevation_min_point = <!-- for denoting the measurement point --> | elevation_min_rank = <!-- population --> | population_footnotes = <!-- for references: use <ref> tags --> | population_as_of = | population_total = | pop_est_footnotes = | pop_est_as_of = | population_est = | population_rank = | population_density_km2 = <!-- for automatic calculation of any density field, use: auto --> | population_density_sq_mi = | population_urban_footnotes = | population_urban = | population_density_urban_km2 = | population_density_urban_sq_mi = | population_rural_footnotes = | population_rural = | population_density_rural_km2 = | population_density_rural_sq_mi = | population_metro_footnotes = | population_metro = | population_density_metro_km2 = | population_density_metro_sq_mi = | population_density_rank = | population_blank1_title = | population_blank1 = | population_density_blank1_km2 = | population_density_blank1_sq_mi = | population_blank2_title = | population_blank2 = | population_density_blank2_km2 = | population_density_blank2_sq_mi = | population_demonym = <!-- demonym, e.g. Liverpudlian for someone from Liverpool --> | population_demonyms = | population_note = <!-- demographics (section 1) --> | demographics_type1 = | demographics1_footnotes = <!-- for references: use <ref> tags --> | demographics1_title1 = | demographics1_info1 = <!-- etc., up to demographics1_title7 / demographics1_info7 --> <!-- demographics (section 2) --> | demographics_type2 = | demographics2_footnotes = <!-- for references: use <ref> tags --> | demographics2_title1 = | demographics2_info1 = <!-- etc., up to demographics2_title10 / demographics2_info10 --> <!-- time zone(s) --> | timezone_link = | timezone1_location = | timezone1 = | utc_offset1 = | timezone1_DST = | utc_offset1_DST = | timezone2_location = | timezone2 = | utc_offset2 = | timezone2_DST = | utc_offset2_DST = | timezone3_location = | timezone3 = | utc_offset3 = | timezone3_DST = | utc_offset3_DST = | timezone4_location = | timezone4 = | utc_offset4 = | timezone4_DST = | utc_offset4_DST = | timezone5_location = | timezone5 = | utc_offset5 = | timezone5_DST = | utc_offset5_DST = <!-- postal codes, area code --> | postal_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... --> | postal_code = | postal2_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... --> | postal2_code = | area_code_type = <!-- defaults to: Area code(s) --> | area_code = | area_codes = | geocode = | iso_code = | registration_plate_type = | registration_plate = | code1_name = | code1_info = | code2_name = | code2_info = <!-- blank fields (section 1) --> | blank_name_sec1 = | blank_info_sec1 = | blank1_name_sec1 = | blank1_info_sec1 = | blank2_name_sec1 = | blank2_info_sec1 = <!-- etc., up to blank7_name_sec1 / blank7_info_sec1 --> <!-- blank fields (section 2) --> | blank_name_sec2 = | blank_info_sec2 = | blank1_name_sec2 = | blank1_info_sec2 = | blank2_name_sec2 = | blank2_info_sec2 = <!-- etc., up to blank7_name_sec2 / blank7_info_sec2 --> <!-- website, footnotes --> | website = <!-- {{URL|example.com}} --> | module = | footnotes = }} </syntaxhighlight> ==Parameter names and descriptions== {| class="wikitable" style="background: white" | colspan=3 style="background: orange; text-align: center;" | ===Name and transliteration=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" | '''name''' || optional || This is the usual name in English. If it's not specified, the infobox will use the '''official_name''' as a title unless this too is missing, in which case the page name will be used. |- style="vertical-align:top;" | '''official_name''' || optional || The official name in English. Avoid using '''official_name''' if it leads to redundancy with '''name''' and '''settlement_type'''. Use '''official_name''' if the official name is unusual or cannot be simply deduced from the name and settlement type. |- style="vertical-align:top;" | '''native_name''' || optional || Name in the local language, if different from '''name''', and if not English. This will display below the name/official name. |- style="vertical-align:top;" | '''native_name_lang''' || optional || Use [[List of ISO 639-1 codes|ISO 639-1 code]], e.g. "fr" for French. If there is more than one native name, in different languages, enter those names using {{tl|lang}}, instead. |- style="vertical-align:top;" | '''other_name''' || optional || For places with a former or more common name like Bombay or Saigon |- style="vertical-align:top;" | '''settlement_type''' || optional || Any type can be entered, such as City, Town, Village, Hamlet, Municipality, Reservation, etc. If set, will be displayed under the names. Might also be used as a label for total population/area (defaulting to ''City''), if needed to distinguish from ''Urban'', ''Rural'' or ''Metro'' (if urban, rural or metro figures are not present, the label is ''Total'' unless '''total_type''' is set). |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Transliteration(s) |- style="vertical-align:top;" | '''translit_lang1''' || optional || Will place the "entry" before the word "transliteration(s)". Can be used to specify a particular language like in [[Dêlêg]] or one may just enter "Other", like in [[Gaza City|Gaza]]'s article. |- style="vertical-align:top;" | '''translit_lang1_type'''<br />'''translit_lang1_type1'''<br />to<br />'''translit_lang1_type6''' || optional || |- style="vertical-align:top;" | '''translit_lang1_info'''<br />'''translit_lang1_info1'''<br />to<br />'''translit_lang1_info6''' || optional || |- style="vertical-align:top;" | '''translit_lang2''' || optional || Will place a second transliteration. See [[Dêlêg]] |- style="vertical-align:top;" | '''translit_lang2_type'''<br />'''translit_lang2_type1'''<br />to<br />'''translit_lang2_type6''' || optional || |- style="vertical-align:top;" | '''translit_lang2_info'''<br />'''translit_lang2_info1'''<br />to<br />'''translit_lang2_info6''' || optional || |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Images, nickname, motto=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Image |- style="vertical-align:top;" | '''image_skyline''' || optional || Primary image representing the settlement. Commonly a photo of the settlement’s skyline. |- style="vertical-align:top;" | '''imagesize''' || optional || Can be used to tweak the size of the image_skyline up or down. This can be helpful if an editor wants to make the infobox wider. If used, '''px''' must be specified; default size is 250px. |- style="vertical-align:top;" | '''image_alt''' || optional || [[Alt text]] for the image, used by visually impaired readers who cannot see the image. See [[WP:ALT]]. |- style="vertical-align:top;" | '''image_caption''' || optional || Will place a caption under the image_skyline (if present) |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Flag image |- style="vertical-align:top;" | '''image_flag''' || optional || Used for a flag. |- style="vertical-align:top;" | '''flag_size''' || optional || Can be used to tweak the size of the image_flag up or down from 100px as desired. If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''flag_alt''' || optional || Alt text for the flag. |- style="vertical-align:top;" | '''flag_border''' || optional || Set to 'no' to remove the border from the flag |- style="vertical-align:top;" | '''flag_link''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Seal image |- style="vertical-align:top;" | '''image_seal''' || optional || If the place has an official seal. |- style="vertical-align:top;" | '''seal_size''' || optional || If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''seal_alt''' || optional || Alt text for the seal. |- style="vertical-align:top;" | '''seal_link'''<br />'''seal_type''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Coat of arms image |- style="vertical-align:top;" | '''image_shield''' || optional || Can be used for a place with a coat of arms. |- style="vertical-align:top;" | '''shield_size''' || optional || If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''shield_alt''' || optional || Alt text for the shield. |- style="vertical-align:top;" | '''shield_link''' || optional || Can be used if a wiki article if known but is not automatically linked by the template. See [[Coquitlam, British Columbia]]'s infobox for an example. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Logo or emblem image |- style="vertical-align:top;" | '''image_blank_emblem''' || optional || Can be used if a place has an official logo, crest, emblem, etc. |- style="vertical-align:top;" | '''blank_emblem_type''' || optional || Caption beneath "image_blank_emblem" to specify what type of emblem it is. |- style="vertical-align:top;" | '''blank_emblem_size''' || optional || If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''blank_emblem_alt''' || optional || Alt text for blank emblem. |- style="vertical-align:top;" | '''blank_emblem_link''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Nickname, motto |- style="vertical-align:top;" | '''etymology''' || optional || origin of name |- style="vertical-align:top;" | '''nickname''' || optional || well-known nickname |- style="vertical-align:top;" | '''nicknames''' || optional || if more than one well-known nickname, use this |- style="vertical-align:top;" | '''motto''' || optional || Will place the motto under the nicknames |- style="vertical-align:top;" | '''mottoes''' || optional || if more than one motto, use this |- style="vertical-align:top;" | '''anthem''' || optional || Will place the anthem (song) under the nicknames |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Maps, coordinates=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Map images |- style="vertical-align:top;" | '''image_map''' || optional || |- style="vertical-align:top;" | '''mapsize''' || optional || If used, '''px''' must be specified; default is 250px. |- style="vertical-align:top;" | '''map_alt''' || optional || Alt text for map. |- style="vertical-align:top;" | '''map_caption''' || optional || |- style="vertical-align:top;" | '''image_map1''' || optional || A secondary map image. The field '''image_map''' must be filled in first. Example see: [[Bloomsburg, Pennsylvania]]. |- style="vertical-align:top;" | '''mapsize1''' || optional || If used, '''px''' must be specified; default is 250px. |- style="vertical-align:top;" | '''map_alt1''' || optional || Alt text for secondary map. |- style="vertical-align:top;" | '''map_caption1''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Pushpin map(s), coordinates |- style="vertical-align:top;" | '''pushpin_map''' || optional || The name of a location map as per [[Template:Location map]] (e.g. ''Indonesia'' or ''Russia''). The coordinate fields (from {{para|coordinates}}) position a pushpin coordinate marker and label on the map '''automatically'''. Example: [[Padang, Indonesia]]. To show multiple pushpin maps, provide a list of maps separated by #, e.g., ''California#USA'' |- style="vertical-align:top;" | '''pushpin_mapsize''' || optional || Must be entered as only a number—'''do not use px'''. The default value is 250.<br/>''Equivalent to <code>width</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_map_alt''' || optional || Alt text for pushpin map; used by [[screen reader]]s, see [[WP:ALT]].<br/>''Equivalent to <code>alt</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_map_caption''' || optional || Fill out if a different caption from ''map_caption'' is desired.<br/>''Equivalent to <code>caption</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_map_caption_notsmall''' || optional || <!-- add documentation here --> |- style="vertical-align:top;" | '''pushpin_label''' || optional || The text of the label to display next to the identifying mark; a [[Wiki markup|wikilink]] can be used. If not specified, the label will be the text assigned to the ''name'' or ''official_name'' parameters (if {{para|pushpin_label_position|none}}, no label is displayed).<br/>''Equivalent to <code>label</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_label_position''' || optional || The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are {left, right, top, bottom, none}. If this field is not specified, the default value is ''right''.<br/>''Equivalent to <code>position</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_outside''' || optional || ''Equivalent to <code>outside</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_relief''' || optional || Set this to <code>y</code> or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available). <br/>''Equivalent to <code>relief</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_image''' || optional || Allows the use of an alternative map; the image must have the same edge coordinates as the location map template.<br/>''Equivalent to <code>AlternativeMap</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_overlay''' || optional || Can be used to specify an image to be superimposed on the regular pushpin map.<br/>''Equivalent to <code>overlay_image</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''coordinates''' || optional || Latitude and longitude. Use {{tl|Coord}}. See the documentation for {{tl|Coord}} for more details on usage. |- style="vertical-align:top;" | '''coor_pinpoint''' || optional || If needed, to specify more exactly where (or what) coordinates are given (e.g. ''Town Hall'') or a specific place in a larger area (e.g. a city in a county). Example: In the article [[Masovian Voivodeship]], <code>coor_pinpoint=Warsaw</code> specifies [[Warsaw]]. |- style="vertical-align:top;" | '''coordinates_footnotes''' || optional || Reference(s) for coordinates, placed within <code><nowiki><ref> </ref></nowiki></code> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''grid_name'''<br />'''grid_position''' || optional || Name of a regional grid system and position on the regional grid |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Location, established, seat, subdivisions, government, leaders=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Location |- style="vertical-align:top;" | {{anchor|subdivision_type}}'''subdivision_type''' || optional || almost always <code><nowiki>Country</nowiki></code> |- style="vertical-align:top;" | '''subdivision_name''' || optional || Depends on the subdivision_type — use the name in text form, sample: <code>United States</code>. Per [[MOS:INFOBOXFLAG]], flag icons or flag templates may be used in this field |- style="vertical-align:top;" | '''subdivision_type1'''<br />to<br />'''subdivision_type6''' || optional || Can be State/Province, region, county. These labels are for subdivisions ''above'' the level of the settlement described in the article. For subdivisions ''below'' or ''within'' the place described in the article, use {{para|parts_type}}. |- style="vertical-align:top;" | '''subdivision_name1'''<br />to<br />'''subdivision_name6''' || optional || Use the name in text form, sample: <code>Florida</code> or <code><nowiki>[[Florida]]</nowiki></code>. Per [[MOS:INFOBOXFLAG]], flag icons or flag templates should '''not''' be used in these fields |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Established |- style="vertical-align:top;" | '''established_title''' || optional || Example: Founded |- style="vertical-align:top;" | '''established_date''' || optional || Requires established_title= |- style="vertical-align:top;" | '''established_title1''' || optional || Example: Incorporated (town) <br/>[Note that "established_title1" is distinct from "established_title"; you can think of "established_title" as behaving like "established_title0".] |- style="vertical-align:top;" | '''established_date1''' || optional || [See note for "established_title1".] Requires established_title1= |- style="vertical-align:top;" | '''established_title2''' || optional || Example: Incorporated (city) |- style="vertical-align:top;" | '''established_date2''' || optional || Requires established_title2= |- style="vertical-align:top;" | '''established_title3''' || optional || |- style="vertical-align:top;" | '''established_date3''' || optional || Requires established_title3= |- style="vertical-align:top;" | '''established_title4''' || optional || |- style="vertical-align:top;" | '''established_date4''' || optional || Requires established_title4= |- style="vertical-align:top;" | '''established_title5''' || optional || |- style="vertical-align:top;" | '''established_date5''' || optional || Requires established_title5= |- style="vertical-align:top;" | '''established_title6''' || optional || |- style="vertical-align:top;" | '''established_date6''' || optional || Requires established_title6= |- style="vertical-align:top;" | '''established_title7''' || optional || |- style="vertical-align:top;" | '''established_date7''' || optional || Requires established_title7= |- style="vertical-align:top;" | '''extinct_title''' || optional || For when a settlement ceases to exist |- style="vertical-align:top;" | '''extinct_date''' || optional || Requires extinct_title= |- style="vertical-align:top;" | '''founder''' || optional || Who the settlement was founded by |- style="vertical-align:top;" | '''named_for''' || optional || The source of the name of the settlement (a person, a place, et cetera) |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Seat of government |- style="vertical-align:top;" | '''seat_type''' || optional || The label for the seat of government (defaults to ''Seat''). |- style="vertical-align:top;" | '''seat''' || optional || The seat of government. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Smaller parts (e.g. boroughs of a city) |- style="vertical-align:top;" | '''parts_type''' || optional || The label for the smaller subdivisions (defaults to ''Boroughs''). |- style="vertical-align:top;" | '''parts_style''' || optional || Set to ''list'' to display as a collapsible list, ''coll'' as a collapsed list, or ''para'' to use paragraph style. Default is ''list'' for up to 5 items, otherwise ''coll''. |- style="vertical-align:top;" | '''parts''' || optional || Text or header of the list of smaller subdivisions. |- style="vertical-align:top;" | '''p1'''<br />'''p2'''<br />to<br />'''p50''' || optional || The smaller subdivisions to be listed. Example: [[Warsaw]] |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Government type, leaders |- style="vertical-align:top;" | '''government_footnotes''' || optional || Reference(s) for government, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''government_type''' || optional || Examples: [[Mayor–council government]], [[Council–manager government]], [[City commission government]], ... |- style="vertical-align:top;" | '''governing_body''' || optional || Name of the place's governing body |- style="vertical-align:top;" | '''leader_party''' || optional || Political party of the place's leader |- style="vertical-align:top;" | '''leader_title''' || optional || First title of the place's leader, e.g. Mayor |- style="vertical-align:top;" | '''leader_name''' || optional || Name of the place's leader |- style="vertical-align:top;" | '''leader_title1'''<br />to<br />'''leader_title4''' || optional || |- style="vertical-align:top;" | '''leader_name1'''<br />to<br />'''leader_name4''' || optional || For long lists use {{tl|Collapsible list}}. See [[Halifax Regional Municipality|Halifax]] for an example. |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Geographic information=== |- style="vertical-align:top;" | colspan=3 | These fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they should enter both values in their respective fields. |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Display settings |- style="vertical-align:top;" | '''total_type''' || optional || Specifies what "total" area and population figure refer to, e.g. ''Greater London''. This overrides other labels for total population/area. To make the total area and population display on the same line as the words "Area" and "Population", with no "Total" or similar label, set the value of this parameter to '''&amp;nbsp;'''. |- style="vertical-align:top;" | '''unit_pref''' || optional || To change the unit order to ''imperial (metric)'', enter '''imperial'''. The default display style is ''metric (imperial)''. However, the template will swap the order automatically if the '''subdivision_name''' equals some variation of the US or the UK.<br />For the middle east, a unit preference of [[dunam]] can be entered (only affects total area). <br /> All values must be entered in a '''raw format: no commas, spaces, or unit symbols'''. The template will format them automatically. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Area |- style="vertical-align:top;" | '''area_footnotes''' || optional || Reference(s) for area, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''dunam_link''' || optional || If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting <code>dunam_link</code> to another measure (e.g. <code>dunam_link=water</code>). Linking can also be turned off by setting the parameter to something else (e.g. <code>dunam_link=none</code> or <code>dunam_link=off</code>). |- style="vertical-align:top;" | '''area_total_km2''' || optional || Total area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_total_sq_mi is empty. |- style="vertical-align:top;" | '''area_total_ha''' || optional || Total area in hectares—symbol: ha. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display acres if area_total_acre is empty. |- style="vertical-align:top;" | '''area_total_sq_mi''' || optional || Total area in square miles—symbol: sq&nbsp;mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_total_km2 is empty. |- style="vertical-align:top;" | '''area_total_acre''' || optional || Total area in acres. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display hectares if area_total_ha is empty. |- style="vertical-align:top;" | '''area_total_dunam''' || optional || Total area in dunams, which is wiki-linked. Used in middle eastern places like Israel, Gaza, and the West Bank. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers or hectares and square miles or acreds if area_total_km2, area_total_ha, area_total_sq_mi, and area_total_acre are empty. Examples: [[Gaza City|Gaza]] and [[Ramallah]] |- style="vertical-align:top;" | '''area_land_km2''' || optional || Land area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_land_sq_mi is empty. |- style="vertical-align:top;" | '''area_land_sq_mi''' || optional || Land area in square miles—symbol: sq&nbsp;mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_land_km2 is empty. |- style="vertical-align:top;" | '''area_land_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_land_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_land_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_water_km2''' || optional || Water area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_water_sq_mi is empty. |- style="vertical-align:top;" | '''area_water_sq_mi''' || optional || Water area in square miles—symbol: sq&nbsp;mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_water_km2 is empty. |- style="vertical-align:top;" | '''area_water_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_water_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_water_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_water_percent''' || optional || percent of water without the "%" |- style="vertical-align:top;" | '''area_urban_km2''' || optional || |- style="vertical-align:top;" | '''area_urban_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_urban_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_urban_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_urban_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" |- style="vertical-align:top;" | '''area_rural_km2''' || optional || |- style="vertical-align:top;" | '''area_rural_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_rural_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_rural_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_rural_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_metro_km2''' || optional || |- style="vertical-align:top;" | '''area_metro_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_metro_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_metro_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_metro_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_rank''' || optional || The settlement's area, as ranked within its parent sub-division |- style="vertical-align:top;" | '''area_blank1_title''' || optional || Example see London |- style="vertical-align:top;" | '''area_blank1_km2''' || optional || |- style="vertical-align:top;" | '''area_blank1_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_blank1_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_blank1_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_blank1_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_blank2_title''' || optional || |- style="vertical-align:top;" | '''area_blank2_km2''' || optional || |- style="vertical-align:top;" | '''area_blank2_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_blank2_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_blank2_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_blank2_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_note''' || optional || A place for additional information such as the name of the source. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Dimensions |- style="vertical-align:top;" | '''dimensions_footnotes''' || optional || Reference(s) for dimensions, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''length_km''' || optional || Raw number entered in kilometers. Will automatically convert to display length in miles if length_mi is empty. |- style="vertical-align:top;" | '''length_mi''' || optional || Raw number entered in miles. Will automatically convert to display length in kilometers if length_km is empty. |- style="vertical-align:top;" | '''width_km''' || optional || Raw number entered in kilometers. Will automatically convert to display width in miles if length_mi is empty. |- style="vertical-align:top;" | '''width_mi''' || optional || Raw number entered in miles. Will automatically convert to display width in kilometers if length_km is empty. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Elevation |- style="vertical-align:top;" | '''elevation_footnotes''' || optional || Reference(s) for elevation, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''elevation_m''' || optional || Raw number entered in meters. Will automatically convert to display elevation in feet if elevation_ft is empty. However, if a range in elevation (i.e. 5–50 m ) is desired, use the "max" and "min" fields below |- style="vertical-align:top;" | '''elevation_ft''' || optional || Raw number, entered in feet. Will automatically convert to display the average elevation in meters if '''elevation_m''' field is empty. However, if a range in elevation (e.g. 50–500&nbsp;ft ) is desired, use the "max" and "min" fields below |- style="vertical-align:top;" | '''elevation_max_footnotes'''<br />'''elevation_min_footnotes''' || optional || Same as above, but for the "max" and "min" elevations. See [[City of Leeds]]. |- style="vertical-align:top;" | '''elevation_max_m'''<br />'''elevation_max_ft'''<br />'''elevation_max_rank'''<br />'''elevation_min_m'''<br />'''elevation_min_ft'''<br />'''elevation_min_rank''' || optional || Used to give highest & lowest elevations and rank, instead of just a single value. Example: [[Halifax Regional Municipality]]. |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Population, demographics=== |- style="vertical-align:top;" | colspan=3 | The density fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they can enter both values in their respective fields. '''To calculate density with respect to the total area automatically, type ''auto'' in place of any density value.''' |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Population |- style="vertical-align:top;" | '''population_total''' || optional || Actual population (see below for estimates) preferably consisting of digits only (without any commas) |- style="vertical-align:top;" | '''population_as_of''' || optional || The year for the population total (usually a census year) |- style="vertical-align:top;" | '''population_footnotes''' || optional || Reference(s) for population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_km2''' || optional || |- style="vertical-align:top;" | '''population_density_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_est''' || optional || Population estimate. |- style="vertical-align:top;" | '''pop_est_as_of''' || optional || The year or month & year of the population estimate |- style="vertical-align:top;" | '''pop_est_footnotes''' || optional || Reference(s) for population estimate, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_urban''' || optional || |- style="vertical-align:top;" | '''population_urban_footnotes''' || optional || Reference(s) for urban population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_urban_km2''' || optional || |- style="vertical-align:top;" | '''population_density_urban_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_rural''' || optional || |- style="vertical-align:top;" | '''population_rural_footnotes''' || optional || Reference(s) for rural population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_rural_km2''' || optional || |- style="vertical-align:top;" | '''population_density_rural_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_metro''' || optional || |- style="vertical-align:top;" | '''population_metro_footnotes''' || optional || Reference(s) for metro population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_metro_km2''' || optional || |- style="vertical-align:top;" | '''population_density_metro_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_rank''' || optional || The settlement's population, as ranked within its parent sub-division |- style="vertical-align:top;" | '''population_density_rank''' || optional || The settlement's population density, as ranked within its parent sub-division |- style="vertical-align:top;" | '''population_blank1_title''' || optional || Can be used for estimates. Example: [[Windsor, Ontario]] |- style="vertical-align:top;" | '''population_blank1''' || optional || The population value for blank1_title |- style="vertical-align:top;" | '''population_density_blank1_km2''' || optional || |- style="vertical-align:top;" | '''population_density_blank1_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_blank2_title''' || optional || |- style="vertical-align:top;" | '''population_blank2''' || optional || |- style="vertical-align:top;" | '''population_density_blank2_km2''' || optional || |- style="vertical-align:top;" | '''population_density_blank2_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_demonym''' || optional || A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in [[Liverpool]] is known as a [[Liverpudlian]]. |- style="vertical-align:top;" | '''population_demonyms''' || optional || If more than one demonym, use this |- style="vertical-align:top;" | '''population_note''' || optional || A place for additional information such as the name of the source. See [[Windsor, Ontario]] for example. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Demographics (section 1) |- style="vertical-align:top;" | '''demographics_type1''' || optional || Section Header. For example: Ethnicity |- style="vertical-align:top;" | '''demographics1_footnotes''' || optional || Reference(s) for demographics section 1, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''demographics1_title1'''<br />to<br />'''demographics1_title7''' || optional || Titles related to demographics_type1. For example: White, Black, Hispanic... |- style="vertical-align:top;" | '''demographics1_info1'''<br />to<br />'''demographics1_info7''' || optional || Information related to the "titles". For example: 50%, 25%, 10%... |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Demographics (section 2) |- style="vertical-align:top;" | '''demographics_type2''' || optional || A second section header. For example: Languages |- style="vertical-align:top;" | '''demographics2_footnotes''' || optional || Reference(s) for demographics section 2, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''demographics2_title1'''<br />to<br />'''demographics2_title10''' || optional || Titles related to '''demographics_type2'''. For example: English, French, Arabic... |- style="vertical-align:top;" | '''demographics2_info1'''<br />to<br />'''demographics2_info10''' || optional || Information related to the "titles" for type2. For example: 50%, 25%, 10%... |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Other information=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Time zone(s) |- style="vertical-align:top;" | '''timezone1''' || optional || |- style="vertical-align:top;" | '''utc_offset1''' || optional || Plain text, e.g. "+05:00" or "-08:00". Auto-linked, so do not include references or additional text. |- style="vertical-align:top;" | '''timezone1_DST''' || optional || |- style="vertical-align:top;" | '''utc_offset1_DST''' || optional || |- style="vertical-align:top;" | '''timezone2''' || optional || A second timezone field for larger areas such as a Province. |- style="vertical-align:top;" | '''utc_offset2''' || optional || |- style="vertical-align:top;" | '''timezone2_DST''' || optional || |- style="vertical-align:top;" | '''utc_offset2_DST''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Postal code(s) & area code |- style="vertical-align:top;" | '''postal_code_type''' || optional || |- style="vertical-align:top;" | '''postal_code''' || optional || |- style="vertical-align:top;" | '''postal2_code_type''' || optional || |- style="vertical-align:top;" | '''postal2_code''' || optional || |- style="vertical-align:top;" | '''area_code_type''' || optional || If left blank/not used template will default to "[[Telephone numbering plan|Area code(s)]]" |- style="vertical-align:top;" | '''area_code''' || optional || Refers to the telephone dialing code for the settlement, ''not'' a geographic area code. |- style="vertical-align:top;" | '''area_codes''' || optional || If more than one area code, use this |- style="vertical-align:top;" | '''geocode''' || optional || See [[Geocode]] |- style="vertical-align:top;" | '''iso_code''' || optional || See [[ISO 3166]] |- style="vertical-align:top;" | '''registration_plate_type''' || optional || If left blank/not used template will default to "[[Vehicle registration plate|Vehicle registration]]" |- style="vertical-align:top;" | '''registration_plate''' || optional || See [[Vehicle registration plate]] |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Blank fields (section 1) |- style="vertical-align:top;" | '''blank_name_sec1''' || optional || Fields used to display other information. The name is displayed in bold on the left side of the infobox. |- style="vertical-align:top;" | '''blank_info_sec1''' || optional || The information associated with the ''blank_name'' heading. The info is displayed on right side of infobox, in the same row as the name. For an example, see: [[Warsaw]] |- style="vertical-align:top;" | '''blank1_name_sec1'''<br />to<br />'''blank7_name_sec1''' || optional || Up to 7 additional fields (8 total) can be displayed in this section |- style="vertical-align:top;" | '''blank1_info_sec1'''<br />to<br />'''blank7_info_sec1''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Blank fields (section 2) |- style="vertical-align:top;" | '''blank_name_sec2''' || optional || For a second section of blank fields |- style="vertical-align:top;" | '''blank_info_sec2''' || optional || Example: [[Beijing]] |- style="vertical-align:top;" | '''blank1_name_sec2'''<br />to<br />'''blank7_name_sec2''' || optional || Up to 7 additional fields (8 total) can be displayed in this section |- style="vertical-align:top;" | '''blank1_info_sec2'''<br />to<br />'''blank7_info_sec2''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Website, footnotes |- style="vertical-align:top;" | '''website''' || optional || External link to official website, Use {{Tl|URL}}, thus: <nowiki>{{URL|example.com}}</nowiki> |- style="vertical-align:top;" | '''module''' || optional || To embed infoboxes at the bottom of the infobox |- style="vertical-align:top;" | '''footnotes''' || optional || Text to be displayed at the bottom of the infobox |- style="vertical-align:top;" | '''short_description''' || optional || [[WP:SHORTDESC|specify custom short description]]; if not specified, one will be automatically generated, e.g. "Place in Israel". |} <!-- End of parameter name/description table --> ==Examples== ;Example 1: <!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. --> {{Infobox settlement | name = Chicago | settlement_type = [[City (Illinois)|City]] | image_skyline = Chicago montage.jpg | imagesize = 275px <!--default is 250px--> | image_caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]] | image_flag = Flag of Chicago, Illinois.svg | image_seal = Seal of Chicago, Illinois.svg | etymology = {{lang-mia|shikaakwa}} ("wild onion" or "wild garlic") | nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]] | motto = {{lang-la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will | image_map = US-IL-Chicago.png | map_caption = Location in the [[Chicago metropolitan area]] and Illinois | pushpin_map = USA | pushpin_map_caption = Location in the United States | coordinates = {{coord|41|50|15|N|87|40|55|W}} | coordinates_footnotes = <ref name="USCB Gazetteer 2010"/> | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = [[Illinois]] | subdivision_type2 = [[List of counties in Illinois|Counties]] | subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]] | established_title = Settled | established_date = 1770s | established_title2 = [[Municipal corporation|Incorporated]] | established_date2 = March 4, 1837 | founder = | named_for = {{lang-mia|shikaakwa}}<br /> ("Wild onion") | government_type = [[Mayor–council government|Mayor–council]] | leader_title = [[Mayor of Chicago|Mayor]] | leader_name = [[Rahm Emanuel]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[City council|Council]] | leader_name1 = [[Chicago City Council]] | unit_pref = Imperial | area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref> | area_total_sq_mi = 234.114 | area_land_sq_mi = 227.635 | area_water_sq_mi = 6.479 | area_water_percent = 3 | area_urban_sq_mi = 2123 | area_metro_sq_mi = 10874 | elevation_footnotes = <ref name="GNIS"/> | elevation_ft = 594 | elevation_m = 181 | population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref> | population_as_of = [[2010 United States Census|2010]] | population_total = 2695598 | pop_est_footnotes = | pop_est_as_of = 2011 | population_est = 2707120 | population_rank = [[List of United States cities by population|3rd US]] | population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi --> | population_urban = 8711000 | population_density_urban_sq_mi = auto | population_metro = 9461105 | population_density_metro_sq_mi = auto | population_demonym = Chicagoan | timezone = [[Central Standard Time|CST]] | utc_offset = −06:00 | timezone_DST = [[Central Daylight Time|CDT]] | utc_offset_DST = −05:00 | area_code_type = [[North American Numbering Plan|Area codes]] | area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]] | blank_name = [[Federal Information Processing Standards|FIPS]] code | blank_info = {{FIPS|17|14000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|423587}}, {{GNIS 4|428803}} | website = {{URL|www.cityofchicago.org}} | footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref> }} <syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;"> <!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. --> {{Infobox settlement | name = Chicago | settlement_type = [[City (Illinois)|City]] | image_skyline = Chicago montage.jpg | imagesize = 275px <!--default is 250px--> | image_caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]] | image_flag = Flag of Chicago, Illinois.svg | image_seal = Seal of Chicago, Illinois.svg | etymology = {{lang-mia|shikaakwa}} ("wild onion" or "wild garlic") | nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]] | motto = {{lang-la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will | image_map = US-IL-Chicago.png | map_caption = Location in the [[Chicago metropolitan area]] and Illinois | pushpin_map = USA | pushpin_map_caption = Location in the United States | coordinates = {{coord|41|50|15|N|87|40|55|W}} | coordinates_footnotes = <ref name="USCB Gazetteer 2010"/> | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = [[Illinois]] | subdivision_type2 = [[List of counties in Illinois|Counties]] | subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]] | established_title = Settled | established_date = 1770s | established_title2 = [[Municipal corporation|Incorporated]] | established_date2 = March 4, 1837 | founder = | named_for = {{lang-mia|shikaakwa}}<br /> ("Wild onion") | government_type = [[Mayor–council government|Mayor–council]] | leader_title = [[Mayor of Chicago|Mayor]] | leader_name = [[Rahm Emanuel]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[City council|Council]] | leader_name1 = [[Chicago City Council]] | unit_pref = Imperial | area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref> | area_total_sq_mi = 234.114 | area_land_sq_mi = 227.635 | area_water_sq_mi = 6.479 | area_water_percent = 3 | area_urban_sq_mi = 2123 | area_metro_sq_mi = 10874 | elevation_footnotes = <ref name="GNIS"/> | elevation_ft = 594 | elevation_m = 181 | population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref> | population_as_of = [[2010 United States Census|2010]] | population_total = 2695598 | pop_est_footnotes = | pop_est_as_of = 2011 | population_est = 2707120 | population_rank = [[List of United States cities by population|3rd US]] | population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi --> | population_urban = 8711000 | population_density_urban_sq_mi = auto | population_metro = 9461105 | population_density_metro_sq_mi = auto | population_demonym = Chicagoan | timezone = [[Central Standard Time|CST]] | utc_offset = −06:00 | timezone_DST = [[Central Daylight Time|CDT]] | utc_offset_DST = −05:00 | area_code_type = [[North American Numbering Plan|Area codes]] | area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]] | blank_name = [[Federal Information Processing Standards|FIPS]] code | blank_info = {{FIPS|17|14000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|423587}}, {{GNIS 4|428803}} | website = {{URL|www.cityofchicago.org}} | footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref> }} </syntaxhighlight> '''References''' {{reflist}} {{clear}} ---- ;Example 2: {{Infobox settlement | name = Detroit | settlement_type = [[City (Michigan)|City]] | image_skyline = Detroit Montage.jpg | imagesize = 290px | image_caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]]. | image_flag = Flag of Detroit, Michigan.svg | image_seal = Seal of Detroit, Michigan.svg | etymology = {{lang-fr|détroit}} ([[strait]]) | nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313 | motto = ''Speramus Meliora; Resurget Cineribus''<br /><small>([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)</small> | image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg | mapsize = 250x200px | map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]] | pushpin_map = USA | pushpin_map_caption = Location within the [[contiguous United States]] | coordinates = {{coord|42|19|53|N|83|2|45|W}} | coordinates_footnotes = | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = [[Michigan]] | subdivision_type2 = [[List of counties in Michigan|County]] | subdivision_name2 = [[Wayne County, Michigan|Wayne]] | established_title = Founded | established_date = 1701 | established_title2 = Incorporated | established_date2 = 1806 | government_footnotes = <!-- for references: use<ref> tags --> | government_type = [[Mayor–council government|Mayor–council]] | leader_title = [[List of mayors of Detroit|Mayor]] | leader_name = [[Mike Duggan]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[Detroit City Council|City Council]] | leader_name1 = {{collapsible list|bullets=yes | title = Members | 1 = [[Charles Pugh]] – Council President | 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem | 3 = [[JoAnn Watson]] | 4 = [[Kenneth Cockrel, Jr.]] | 5 = [[Saunteel Jenkins]] | 6 = [[Andre Spivey]] | 7 = [[James Tate (Detroit politician)|James Tate]] | 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]] | 9 = [[Kwame Kenyatta]] }} | unit_pref = Imperial | area_footnotes = | area_total_sq_mi = 142.87 | area_total_km2 = 370.03 | area_land_sq_mi = 138.75 | area_land_km2 = 359.36 | area_water_sq_mi = 4.12 | area_water_km2 = 10.67 | area_urban_sq_mi = 1295 | area_metro_sq_mi = 3913 | elevation_footnotes = | elevation_ft = 600 | population_footnotes = | population_as_of = 2011 | population_total = 706585 | population_rank = [[List of United States cities by population|18th in U.S.]] | population_urban = 3863924 | population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]]) | population_blank1_title = [[Combined statistical area|CSA]] | population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]]) | population_density_sq_mi= {{#expr:713777/138.8 round 0}} | population_demonym = Detroiter | population_note = | timezone = [[Eastern Time Zone (North America)|EST]] | utc_offset = −5 | timezone_DST = [[Eastern Daylight Time|EDT]] | utc_offset_DST = −4 | postal_code_type = | postal_code = | area_code = [[Area code 313|313]] | blank_name = [[Federal Information Processing Standards|FIPS code]] | blank_info = {{FIPS|26|22000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|1617959}}, {{GNIS 4|1626181}} | website = [http://www.detroitmi.gov/ DetroitMI.gov] | footnotes = }} <syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;"> {{Infobox settlement | name = Detroit | settlement_type = [[City (Michigan)|City]] | official_name = City of Detroit | image_skyline = Detroit Montage.jpg | imagesize = 290px | image_caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]]. | image_flag = Flag of Detroit, Michigan.svg | image_seal = Seal of Detroit, Michigan.svg | etymology = {{lang-fr|détroit}} ([[strait]]) | nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313 | motto = ''Speramus Meliora; Resurget Cineribus''<br /><small>([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)</small> | image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg | mapsize = 250x200px | map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]] | pushpin_map = USA | pushpin_map_caption = Location within the [[contiguous United States]] | coordinates = {{coord|42|19|53|N|83|2|45|W}} | coordinates_footnotes = | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = Michigan | subdivision_type2 = [[List of counties in Michigan|County]] | subdivision_name2 = [[Wayne County, Michigan|Wayne]] | established_title = Founded | established_date = 1701 | established_title2 = Incorporated | established_date2 = 1806 | government_footnotes = <!-- for references: use<ref> tags --> | government_type = [[Mayor-council government|Mayor-Council]] | leader_title = [[List of mayors of Detroit|Mayor]] | leader_name = [[Mike Duggan]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[Detroit City Council|City Council]] | leader_name1 = {{collapsible list|bullets=yes | title = Members | 1 = [[Charles Pugh]] – Council President | 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem | 3 = [[JoAnn Watson]] | 4 = [[Kenneth Cockrel, Jr.]] | 5 = [[Saunteel Jenkins]] | 6 = [[Andre Spivey]] | 7 = [[James Tate (Detroit politician)|James Tate]] | 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]] | 9 = [[Kwame Kenyatta]] }} | unit_pref = Imperial | area_footnotes = | area_total_sq_mi = 142.87 | area_total_km2 = 370.03 | area_land_sq_mi = 138.75 | area_land_km2 = 359.36 | area_water_sq_mi = 4.12 | area_water_km2 = 10.67 | area_urban_sq_mi = 1295 | area_metro_sq_mi = 3913 | elevation_footnotes = | elevation_ft = 600 | population_footnotes = | population_as_of = 2011 | population_total = 706585 | population_rank = [[List of United States cities by population|18th in U.S.]] | population_urban = 3863924 | population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]]) | population_blank1_title = [[Combined statistical area|CSA]] | population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]]) | population_density_sq_mi= {{#expr:713777/138.8 round 0}} | population_demonym = Detroiter | population_note = | timezone = [[Eastern Time Zone (North America)|EST]] | utc_offset = −5 | timezone_DST = [[Eastern Daylight Time|EDT]] | utc_offset_DST = −4 | postal_code_type = | postal_code = | area_code = [[Area code 313|313]] | blank_name = [[Federal Information Processing Standards|FIPS code]] | blank_info = {{FIPS|26|22000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|1617959}}, {{GNIS 4|1626181}} | website = [http://www.detroitmi.gov/ DetroitMI.gov] | footnotes = }} </syntaxhighlight> {{clear}} ==Supporting templates== The following is a list of sub-templates used by Infobox settlement. See the [{{fullurl:Special:PrefixIndex|prefix=Infobox+settlement%2F&namespace=10&hideredirects=1}} current list of all sub-templates] for documentation, sandboxes, testcases, etc. # {{tl|Infobox settlement/areadisp}} # {{tl|Infobox settlement/densdisp}} # {{tl|Infobox settlement/dunam}} # {{tl|Infobox settlement/dunam/mag}} # {{tl|Infobox settlement/impus}} # {{tl|Infobox settlement/impus/mag}} # {{tl|Infobox settlement/lengthdisp}} # {{tl|Infobox settlement/link}} # {{tl|Infobox settlement/metric}} # {{tl|Infobox settlement/metric/mag}} # {{tl|Infobox settlement/pref}} ==Microformat== {{UF-hcard-geo}} == TemplateData == {{TemplateData header}} {{collapse top|title=TemplateData}} <templatedata> { "description": "Infobox for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, etc.", "format": "{{_\n| __________________ = _\n}}\n", "params": { "name": { "label": "Common name", "description": "This is the usual name in English. If it's not specified, the infobox will use the 'official_name' as a title unless this too is missing, in which case the page name will be used.", "type": "string", "suggested": true }, "official_name": { "label": "Official name", "description": "The official name in English, if different from 'name'.", "type": "string", "suggested": true }, "native_name": { "label": "Native name", "description": "This will display under the name/official name.", "type": "string", "example": "Distrito Federal de México" }, "native_name_lang": { "label": "Native name language", "description": "Use ISO 639-1 code, e.g. 'fr' for French. If there is more than one native name in different languages, enter those names using {{lang}} instead.", "type": "string", "example": "zh" }, "other_name": { "label": "Other name", "description": "For places with a former or more common name like Bombay or Saigon.", "type": "string" }, "settlement_type": { "label": "Type of settlement", "description": "Any type can be entered, such as 'City', 'Town', 'Village', 'Hamlet', 'Municipality', 'Reservation', etc. If set, will be displayed under the names, provided either 'name' or 'official_name' is filled in. Might also be used as a label for total population/area (defaulting to 'City'), if needed to distinguish from 'Urban', 'Rural' or 'Metro' (if urban, rural or metro figures are not present, the label is 'Total' unless 'total_type' is set).", "type": "string", "aliases": [ "type" ] }, "translit_lang1": { "label": "Transliteration from language 1", "description": "Will place the entry before the word 'transliteration(s)'. Can be used to specify a particular language, like in Dêlêg, or one may just enter 'Other', like in Gaza's article.", "type": "string" }, "translit_lang1_type": { "label": "Transliteration type for language 1", "type": "line", "example": "[[Hanyu pinyin]]", "description": "The type of transliteration used for the first language." }, "translit_lang1_info": { "label": "Transliteration language 1 info", "description": "Parameters 'translit_lang2_info1' ... 'translit_lang2_info6' are also available, but not documented here.", "type": "string" }, "translit_lang2": { "label": "Transliteration language 2", "description": "Will place a second transliteration. See Dêlêg.", "type": "string" }, "image_skyline": { "label": "Image", "description": "Primary image representing the settlement. Commonly a photo of the settlement’s skyline.", "type": "wiki-file-name" }, "imagesize": { "label": "Image size", "description": "Can be used to tweak the size of 'image_skyline' up or down. This can be helpful if an editor wants to make the infobox wider. If used, 'px' must be specified; default size is 250px.", "type": "string" }, "image_alt": { "label": "Image alt text", "description": "Alt (hover) text for the image, used by visually impaired readers who cannot see the image.", "type": "string" }, "image_caption": { "label": "Image caption", "description": "Will place a caption under 'image_skyline' (if present).", "type": "content" }, "image_flag": { "label": "Flag image", "description": "Used for a flag.", "type": "wiki-file-name" }, "flag_size": { "label": "Flag size", "description": "Can be used to tweak the size of 'image_flag' up or down from 100px as desired. If used, 'px' must be specified; default size is 100px.", "type": "string" }, "flag_alt": { "label": "Flag alt text", "description": "Alt text for the flag.", "type": "string" }, "flag_border": { "label": "Flag border?", "description": "Set to 'no' to remove the border from the flag.", "type": "boolean", "example": "no" }, "flag_link": { "label": "Flag link", "type": "string", "description": "Link to the flag." }, "image_seal": { "label": "Official seal image", "description": "An image of an official seal, if the place has one.", "type": "wiki-file-name" }, "seal_size": { "label": "Seal size", "description": "If used, 'px' must be specified; default size is 100px.", "type": "string" }, "seal_alt": { "label": "Seal alt text", "description": "Alt (hover) text for the seal.", "type": "string" }, "seal_link": { "label": "Seal link", "type": "string", "description": "Link to the seal." }, "image_shield": { "label": "Coat of arms/shield image", "description": "Can be used for a place with a coat of arms.", "type": "wiki-file-name" }, "shield_size": { "label": "Shield size", "description": "If used, 'px' must be specified; default size is 100px.", "type": "string", "example": "200px" }, "shield_alt": { "label": "Shield alt text", "description": "Alternate text for the shield.", "type": "string" }, "shield_link": { "label": "Shield link", "description": "Can be used if a wiki article if known but is not automatically linked by the template. See Coquitlam, British Columbia's infobox for an example.", "type": "string" }, "image_blank_emblem": { "label": "Blank emblem image", "description": "Can be used if a place has an official logo, crest, emblem, etc.", "type": "wiki-file-name" }, "blank_emblem_type": { "label": "Blank emblem type", "description": "Caption beneath 'image_blank_emblem' to specify what type of emblem it is.", "type": "string", "example": "Logo" }, "blank_emblem_size": { "label": "Blank emblem size", "description": "If used, 'px' must be specified; default size is 100px.", "type": "string", "example": "200px" }, "blank_emblem_alt": { "label": "Blank emblem alt text", "description": "Alt text for blank emblem.", "type": "string" }, "blank_emblem_link": { "label": "Blank emblem link", "type": "string", "description": "A link to the emblem of custom type." }, "nickname": { "label": "Nickname", "description": "Well-known nickname(s).", "type": "string", "example": "Sin City" }, "motto": { "label": "Motto", "description": "Will place the motto under the nicknames.", "type": "string" }, "anthem": { "label": "Anthem", "description": "Will place the anthem (song) under the nicknames.", "type": "string", "example": "[[Hatikvah]]" }, "image_map": { "label": "Map image", "description": "A map of the region, or a map with the region highlighted within a parent region.", "type": "wiki-file-name" }, "mapsize": { "label": "Map size", "description": "If used, 'px' must be specified; default is 250px.", "type": "string" }, "map_alt": { "label": "Map alt text", "description": "Alternate (hover) text for the map.", "type": "string" }, "map_caption": { "label": "Map caption", "type": "content", "description": "Caption for the map displayed." }, "image_map1": { "label": "Map 2 image", "description": "A secondary map image. The field 'image_map' must be filled in first. For an example, see [[Bloomsburg, Pennsylvania]].", "example": "File:Columbia County Pennsylvania Incorporated and Unincorporated areas Bloomsburg Highlighted.svg", "type": "wiki-file-name" }, "mapsize1": { "label": "Map 2 size", "description": "If used, 'px' must be specified; default is 250px.", "type": "string", "example": "300px" }, "map_alt1": { "label": "Map 2 alt text", "description": "Alt (hover) text for the second map.", "type": "string" }, "map_caption1": { "label": "Map 2 caption", "type": "content", "description": "Caption of the second map." }, "pushpin_map": { "label": "Pushpin map", "description": "The name of a location map (e.g. 'Indonesia' or 'Russia'). The coordinates information (from the coordinates parameter) positions a pushpin coordinate marker and label on the map automatically. For an example, see Padang, Indonesia.", "type": "string", "example": "Indonesia" }, "pushpin_mapsize": { "label": "Pushpin map size", "description": "Must be entered as only a number—do not use 'px'. The default value is 250.", "type": "number", "example": "200" }, "pushpin_map_alt": { "label": "Pushpin map alt text", "description": "Alt (hover) text for the pushpin map.", "type": "string" }, "pushpin_map_caption": { "label": "Pushpin map caption", "description": "Fill out if a different caption from 'map_caption' is desired.", "type": "string", "example": "Map showing Bloomsburg in Pennsylvania" }, "pushpin_label": { "label": "Pushpin label", "type": "line", "example": "Bloomsburg", "description": "Label of the pushpin." }, "pushpin_label_position": { "label": "Pushpin label position", "description": "The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are 'left', 'right', 'top', 'bottom', and 'none'. If this field is not specified, the default value is 'right'.", "type": "string", "example": "left", "default": "right" }, "pushpin_outside": { "label": "Pushpin outside?", "type": "line" }, "pushpin_relief": { "label": "Pushpin relief", "description": "Set this to 'y' or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available).", "type": "string", "example": "y" }, "pushpin_image": { "label": "Pushpin image", "type": "wiki-file-name", "description": "Image to use for the pushpin." }, "pushpin_overlay": { "label": "Pushpin overlay", "description": "Can be used to specify an image to be superimposed on the regular pushpin map.", "type": "wiki-file-name" }, "coordinates": { "label": "Coordinates", "description": "Latitude and longitude. Use {{Coord}}. See the documentation for {{Coord}} for more details on usage.", "type": "wiki-template-name", "example": "{{coord|41|50|15|N|87|40|55|W}}" }, "coor_pinpoint": { "label": "Coordinate pinpoint", "description": "If needed, to specify more exactly where (or what) coordinates are given (e.g. 'Town Hall') or a specific place in a larger area (e.g. a city in a county). Example: Masovian Voivodeship.", "type": "string" }, "coordinates_footnotes": { "label": "Coordinates footnotes", "description": "Reference(s) for coordinates. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "subdivision_type": { "label": "Subdivision type 1", "description": "Almost always 'Country'.", "type": "string", "example": "[[List of sovereign states|Country]]" }, "subdivision_name": { "label": "Subdivision name 1", "description": "Depends on 'subdivision_type'. Use the name in text form, e.g., 'United States'. Per MOS:INFOBOXFLAG, flag icons or flag templates may be used in this field.", "type": "string" }, "subdivision_type1": { "label": "Subdivision type 2", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type2": { "label": "Subdivision type 3", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type3": { "label": "Subdivision type 4", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type4": { "label": "Subdivision type 5", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type5": { "label": "Subdivision type 6", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type6": { "label": "Subdivision type 7", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_name1": { "label": "Subdivision name 2", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Connecticut]]" }, "subdivision_name2": { "label": "Subdivision name 3", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Florida]]" }, "subdivision_name3": { "label": "Subdivision name 4", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Utah]]" }, "subdivision_name4": { "label": "Subdivision name 5", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[California]]" }, "subdivision_name5": { "label": "Subdivision name 6", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Vermont]]" }, "subdivision_name6": { "label": "Subdivision name 7", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Wyoming]]" }, "established_title": { "label": "First establishment event", "description": "Title of the first establishment event.", "type": "string", "example": "First settled" }, "established_date": { "label": "First establishment date", "type": "date", "description": "Date of the first establishment event." }, "established_title1": { "label": "Second establishment event", "description": "Title of the second establishment event.", "type": "string", "example": "Incorporated as a town" }, "established_date1": { "label": "Second establishment date", "type": "date", "description": "Date of the second establishment event." }, "established_title2": { "label": "Third establishment event", "description": "Title of the third establishment event.", "type": "string", "example": "Incorporated as a city" }, "established_date2": { "label": "Third establishment date", "type": "date", "description": "Date of the third establishment event." }, "established_title3": { "label": "Fourth establishment event", "type": "string", "description": "Title of the fourth establishment event.", "example": "Incorporated as a county" }, "established_date3": { "label": "Fourth establishment date", "type": "date", "description": "Date of the fourth establishment event." }, "extinct_title": { "label": "Extinction event title", "description": "For when a settlement ceases to exist.", "type": "string", "example": "[[Sack of Rome]]" }, "extinct_date": { "label": "Extinction date", "type": "string", "description": "Date the settlement ceased to exist." }, "founder": { "label": "Founder", "description": "Who the settlement was founded by.", "type": "string" }, "named_for": { "label": "Named for", "description": "The source of the name of the settlement (a person, a place, et cetera).", "type": "string", "example": "[[Ho Chi Minh]]" }, "seat_type": { "label": "Seat of government type", "description": "The label for the seat of government (defaults to 'Seat').", "type": "string", "default": "Seat" }, "seat": { "label": "Seat of government", "description": "The seat of government.", "type": "string", "example": "[[White House]]" }, "parts_type": { "label": "Type of smaller subdivisions", "description": "The label for the smaller subdivisions (defaults to 'Boroughs').", "type": "string", "default": "Boroughs" }, "parts_style": { "label": "Parts style", "description": "Set to 'list' to display as a collapsible list, 'coll' as a collapsed list, or 'para' to use paragraph style. Default is 'list' for up to 5 items, otherwise 'coll'.", "type": "string", "example": "list" }, "parts": { "label": "Smaller subdivisions", "description": "Text or header of the list of smaller subdivisions.", "type": "string" }, "p1": { "label": "Smaller subdivision 1", "description": "The smaller subdivisions to be listed. Parameters 'p1' to 'p50' can also be used.", "type": "string" }, "government_footnotes": { "label": "Government footnotes", "description": "Reference(s) for government. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "content" }, "government_type": { "label": "Government type", "description": "The place's type of government.", "type": "string", "example": "[[Mayor–council government]]" }, "governing_body": { "label": "Governing body", "description": "Name of the place's governing body.", "type": "wiki-page-name", "example": "Legislative Council of Hong Kong" }, "leader_party": { "label": "Leader political party", "description": "Political party of the place's leader.", "type": "string" }, "leader_title": { "label": "Leader title", "description": "First title of the place's leader, e.g. 'Mayor'.", "type": "string", "example": "[[Governor (United States)|Governor]]" }, "leader_name": { "label": "Leader's name", "description": "Name of the place's leader.", "type": "string", "example": "[[Jay Inslee]]" }, "leader_title1": { "label": "Leader title 1", "description": "First title of the place's leader, e.g. 'Mayor'.", "type": "string", "example": "Mayor" }, "leader_name1": { "label": "Leader name 1", "description": "Additional names for leaders. Parameters 'leader_name1' .. 'leader_name4' are available. For long lists, use {{Collapsible list}}.", "type": "string" }, "total_type": { "label": "Total type", "description": "Specifies what total area and population figure refer to, e.g. 'Greater London'. This overrides other labels for total population/area. To make the total area and population display on the same line as the words ''Area'' and ''Population'', with no ''Total'' or similar label, set the value of this parameter to '&nbsp;'.", "type": "string" }, "unit_pref": { "label": "Unit preference", "description": "To change the unit order to 'imperial (metric)', enter 'imperial'. The default display style is 'metric (imperial)'. However, the template will swap the order automatically if the 'subdivision_name' equals some variation of the US or the UK. For the Middle East, a unit preference of dunam can be entered (only affects total area). All values must be entered in a raw format (no commas, spaces, or unit symbols). The template will format them automatically.", "type": "string", "example": "imperial" }, "area_footnotes": { "label": "Area footnotes", "description": "Reference(s) for area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "dunam_link": { "label": "Link dunams?", "description": "If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting 'dunam_link' to another measure (e.g. 'dunam_link=water'). Linking can also be turned off by setting the parameter to something else (e.g., 'dunam_link=none' or 'dunam_link=off').", "type": "boolean", "example": "none" }, "area_total_km2": { "label": "Total area (km2)", "description": "Total area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_total_sq_mi' is empty.", "type": "number" }, "area_total_sq_mi": { "label": "Total area (sq. mi)", "description": "Total area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_total_km2' is empty.", "type": "number" }, "area_total_ha": { "label": "Total area (hectares)", "description": "Total area in hectares (symbol: ha). Value must be entered in raw format (no commas or spaces). Auto-converted to display acres if 'area_total_acre' is empty.", "type": "number" }, "area_total_acre": { "label": "Total area (acres)", "description": "Total area in acres. Value must be entered in raw format (no commas or spaces). Auto-converted to display hectares if 'area_total_ha' is empty.", "type": "number" }, "area_total_dunam": { "label": "Total area (dunams)", "description": "Total area in dunams, which is wikilinked. Used in Middle Eastern places like Israel, Gaza, and the West Bank. Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers or hectares and square miles or acres if 'area_total_km2', 'area_total_ha', 'area_total_sq_mi', and 'area_total_acre' are empty. Examples: Gaza and Ramallah.", "type": "number" }, "area_land_km2": { "label": "Land area (sq. km)", "description": "Land area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_land_sq_mi' is empty.", "type": "number" }, "area_land_sq_mi": { "label": "Land area (sq. mi)", "description": "Land area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_land_km2' is empty.", "type": "number" }, "area_land_ha": { "label": "Land area (hectares)", "description": "The place's land area in hectares.", "type": "number" }, "area_land_dunam": { "label": "Land area (dunams)", "description": "The place's land area in dunams.", "type": "number" }, "area_land_acre": { "label": "Land area (acres)", "description": "The place's land area in acres.", "type": "number" }, "area_water_km2": { "label": "Water area (sq. km)", "description": "Water area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_water_sq_mi' is empty.", "type": "number" }, "area_water_sq_mi": { "label": "Water area (sq. mi)", "description": "Water area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_water_km2' is empty.", "type": "number" }, "area_water_ha": { "label": "Water area (hectares)", "description": "The place's water area in hectares.", "type": "number" }, "area_water_dunam": { "label": "Water area (dunams)", "description": "The place's water area in dunams.", "type": "number" }, "area_water_acre": { "label": "Water area (acres)", "description": "The place's water area in acres.", "type": "number" }, "area_water_percent": { "label": "Percent water area", "description": "Percent of water without the %.", "type": "number", "example": "21" }, "area_urban_km2": { "label": "Urban area (sq. km)", "type": "number", "description": "Area of the place's urban area in square kilometers." }, "area_urban_sq_mi": { "label": "Urban area (sq. mi)", "type": "number", "description": "Area of the place's urban area in square miles." }, "area_urban_ha": { "label": "Urban area (hectares)", "description": "Area of the place's urban area in hectares.", "type": "number" }, "area_urban_dunam": { "label": "Urban area (dunams)", "description": "Area of the place's urban area in dunams.", "type": "number" }, "area_urban_acre": { "label": "Urban area (acres)", "description": "Area of the place's urban area in acres.", "type": "number" }, "area_urban_footnotes": { "label": "Urban area footnotes", "description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "area_rural_km2": { "label": "Rural area (sq. km)", "type": "number", "description": "Area of the place's rural area in square kilometers." }, "area_rural_sq_mi": { "label": "Rural area (sq. mi)", "type": "number", "description": "Area of the place's rural area in square miles." }, "area_rural_ha": { "label": "Rural area (hectares)", "description": "Area of the place's rural area in hectares.", "type": "number" }, "area_rural_dunam": { "label": "Rural area (dunams)", "description": "Area of the place's rural area in dunams.", "type": "number" }, "area_rural_acre": { "label": "Rural area (acres)", "description": "Area of the place's rural area in acres.", "type": "number" }, "area_rural_footnotes": { "label": "Rural area footnotes", "description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "area_metro_km2": { "label": "Metropolitan area (sq. km)", "type": "number", "description": "Area of the place's metropolitan area in square kilometers." }, "area_metro_sq_mi": { "label": "Metropolitan area (sq. mi)", "type": "number", "description": "Area of the place's metropolitan area in square miles." }, "area_metro_ha": { "label": "Metropolitan area (hectares)", "description": "Area of the place's metropolitan area in hectares.", "type": "number" }, "area_metro_dunam": { "label": "Metropolitan area (dunams)", "description": "Area of the place's metropolitan area in dunams.", "type": "number" }, "area_metro_acre": { "label": "Metropolitan area (acres)", "description": "Area of the place's metropolitan area in acres.", "type": "number" }, "area_metro_footnotes": { "label": "Metropolitan area footnotes", "description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "area_rank": { "label": "Area rank", "description": "The settlement's area, as ranked within its parent sub-division.", "type": "string" }, "area_blank1_title": { "label": "First blank area section title", "description": "Title of the place's first custom area section.", "type": "string", "example": "see [[London]]" }, "area_blank1_km2": { "label": "Area blank 1 (sq. km)", "type": "number", "description": "Area of the place's first blank area section in square kilometers." }, "area_blank1_sq_mi": { "label": "Area blank 1 (sq. mi)", "type": "number", "description": "Area of the place's first blank area section in square miles." }, "area_blank1_ha": { "label": "Area blank 1 (hectares)", "description": "Area of the place's first blank area section in hectares.", "type": "number" }, "area_blank1_dunam": { "label": "Area blank 1 (dunams)", "description": "Area of the place's first blank area section in dunams.", "type": "number" }, "area_blank1_acre": { "label": "Area blank 1 (acres)", "description": "Area of the place's first blank area section in acres.", "type": "number" }, "area_blank2_title": { "label": "Second blank area section title", "type": "string", "description": "Title of the place's second custom area section." }, "area_blank2_km2": { "label": "Area blank 2 (sq. km)", "type": "number", "description": "Area of the place's second blank area section in square kilometers." }, "area_blank2_sq_mi": { "label": "Area blank 2 (sq. mi)", "type": "number", "description": "Area of the place's second blank area section in square miles." }, "area_blank2_ha": { "label": "Area blank 2 (hectares)", "description": "Area of the place's third blank area section in hectares.", "type": "number" }, "area_blank2_dunam": { "label": "Area blank 2 (dunams)", "description": "Area of the place's third blank area section in dunams.", "type": "number" }, "area_blank2_acre": { "label": "Area blank 2 (acres)", "description": "Area of the place's third blank area section in acres.", "type": "number" }, "area_note": { "label": "Area footnotes", "description": "A place for additional information such as the name of the source.", "type": "content", "example": "<ref name=\"CenPopGazetteer2016\">{{cite web|title=2016 U.S. Gazetteer Files|url=https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2016_Gazetteer/2016_gaz_place_42.txt|publisher=United States Census Bureau|access-date=Aug 13, 2017}}</ref>" }, "dimensions_footnotes": { "label": "Dimensions footnotes", "description": "Reference(s) for dimensions. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "content" }, "length_km": { "label": "Length in km", "description": "Raw number entered in kilometers. Will automatically convert to display length in miles if 'length_mi' is empty.", "type": "number" }, "length_mi": { "label": "Length in miles", "description": "Raw number entered in miles. Will automatically convert to display length in kilometers if 'length_km' is empty.", "type": "number" }, "width_km": { "label": "Width in kilometers", "description": "Raw number entered in kilometers. Will automatically convert to display width in miles if 'length_mi' is empty.", "type": "number" }, "width_mi": { "label": "Width in miles", "description": "Raw number entered in miles. Will automatically convert to display width in kilometers if 'length_km' is empty.", "type": "number" }, "elevation_m": { "label": "Elevation in meters", "description": "Raw number entered in meters. Will automatically convert to display elevation in feet if 'elevation_ft' is empty. However, if a range in elevation (i.e. 5–50&nbsp;m) is desired, use the 'max' and 'min' fields below.", "type": "number" }, "elevation_ft": { "label": "Elevation in feet", "description": "Raw number, entered in feet. Will automatically convert to display the average elevation in meters if 'elevation_m' field is empty. However, if a range in elevation (i.e. 50–500&nbsp;ft) is desired, use the 'max' and 'min' fields below.", "type": "number" }, "elevation_footnotes": { "label": "Elevation footnotes", "description": "Reference(s) for elevation. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "elevation_min_point": { "type": "line", "label": "Point of min elevation", "description": "The name of the point of lowest elevation in the place.", "example": "[[Death Valley]]" }, "elevation_min_m": { "label": "Minimum elevation (m)", "type": "number", "description": "The minimum elevation in meters." }, "elevation_min_ft": { "label": "Minimum elevation (ft)", "type": "number", "description": "The minimum elevation in feet." }, "elevation_min_rank": { "type": "line", "label": "Minimum elevation rank", "description": "The point of minimum elevation's rank in the parent region.", "example": "1st" }, "elevation_min_footnotes": { "label": "Min elevation footnotes", "type": "content", "description": "Footnotes or citations for the minimum elevation." }, "elevation_max_point": { "type": "line", "label": "Point of max elevation", "description": "The name of the point of highest elevation in the place.", "example": "[[Mount Everest]]" }, "elevation_max_m": { "label": "Maximum elevation (m)", "type": "number", "description": "The maximum elevation in meters." }, "elevation_max_ft": { "label": "Maximum elevation (ft)", "type": "number", "description": "The maximum elevation in feet." }, "elevation_max_rank": { "type": "line", "label": "Maximum elevation rank", "description": "The point of maximum elevation's rank in the parent region.", "example": "2nd" }, "elevation_max_footnotes": { "label": "Max elevation footnotes", "type": "content", "description": "Footnotes or citations for the maximum elevation." }, "population_total": { "label": "Population total", "description": "Actual population (see below for estimates) preferably consisting of digits only (without any commas).", "type": "number" }, "population_as_of": { "label": "Population total figure's year", "description": "The year for the population total (usually a census year).", "type": "number" }, "population_footnotes": { "label": "Population footnotes", "description": "Reference(s) for population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content" }, "population_density_km2": { "label": "Population density (per square km)", "type": "string", "description": "The place's population density per square kilometer.", "example": "auto" }, "population_density_sq_mi": { "label": "Population density (per square mi)", "type": "string", "description": "The place's population density per square mile.", "example": "auto" }, "population_est": { "label": "Population estimate", "description": "Population estimate, e.g. for growth projections 4 years after a census.", "type": "number", "example": "331000000" }, "pop_est_as_of": { "label": "Population estimate figure as of", "description": "The year, or the month and year, of the population estimate.", "type": "date" }, "pop_est_footnotes": { "label": "Population estimate footnotes", "description": "Reference(s) for population estimate; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content", "example": "<ref name=\"USCensusEst2016\"/>" }, "population_urban": { "label": "Urban population", "type": "number", "description": "The place's urban population." }, "population_urban_footnotes": { "label": "Urban population footnotes", "description": "Reference(s) for urban population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content" }, "population_density_urban_km2": { "label": "Urban population density (per square km)", "type": "string", "description": "The place's urban population density per square kilometer.", "example": "auto" }, "population_density_urban_sq_mi": { "label": "Urban population density (per square mi)", "type": "string", "description": "The place's urban population density per square mile.", "example": "auto" }, "population_rural": { "label": "Rural population", "type": "number", "description": "The place's rural population." }, "population_rural_footnotes": { "label": "Rural population footnotes", "description": "Reference(s) for rural population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content" }, "population_density_rural_km2": { "label": "Rural population density per sq. km", "type": "line", "description": "The place's rural population density per square kilometer.", "example": "auto" }, "population_density_rural_sq_mi": { "label": "Rural population density per sq. mi", "type": "line", "description": "The place's rural population density per square mile.", "example": "auto" }, "population_metro": { "label": "Metropolitan area population", "type": "number", "description": "Population of the place's metropolitan area." }, "population_metro_footnotes": { "label": "Metropolitan area population footnotes", "description": "Reference(s) for metro population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "string" }, "population_density_metro_km2": { "label": "Metropolitan population density per sq. km", "type": "number", "description": "The place's metropolitan area's population density per square kilometer.", "example": "auto" }, "population_density_metro_sq_mi": { "label": "Metropolitan population density per sq. mi", "type": "number", "description": "The place's metropolitan area's population density per square mile.", "example": "auto" }, "population_rank": { "label": "Population rank", "description": "The settlement's population, as ranked within its parent sub-division.", "type": "string" }, "population_density_rank": { "label": "Population density rank", "description": "The settlement's population density, as ranked within its parent sub-division.", "type": "string" }, "population_blank1_title": { "label": "Custom population type 1 title", "description": "Can be used for estimates. For an example, see Windsor, Ontario.", "type": "string", "example": "See: [[Windsor, Ontario]]" }, "population_blank1": { "label": "Custom population type 1", "description": "The population value for 'blank1_title'.", "type": "string" }, "population_density_blank1_km2": { "label": "Custom population type 1 density per sq. km", "type": "string", "description": "Population density per square kilometer, according to the 1st custom population type." }, "population_density_blank1_sq_mi": { "label": "Custom population type 1 density per sq. mi", "type": "string", "description": "Population density per square mile, according to the 1st custom population type." }, "population_blank2_title": { "label": "Custom population type 2 title", "description": "Can be used for estimates. For an example, see Windsor, Ontario.", "type": "string", "example": "See: [[Windsor, Ontario]]" }, "population_blank2": { "label": "Custom population type 2", "description": "The population value for 'blank2_title'.", "type": "string" }, "population_density_blank2_km2": { "label": "Custom population type 2 density per sq. km", "type": "string", "description": "Population density per square kilometer, according to the 2nd custom population type." }, "population_density_blank2_sq_mi": { "label": "Custom population type 2 density per sq. mi", "type": "string", "description": "Population density per square mile, according to the 2nd custom population type." }, "population_demonym": { "label": "Demonym", "description": "A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in Liverpool is known as a Liverpudlian.", "type": "line", "example": "Liverpudlian" }, "population_note": { "label": "Population note", "description": "A place for additional information such as the name of the source. See Windsor, Ontario, for an example.", "type": "content" }, "demographics_type1": { "label": "Demographics type 1", "description": "A sub-section header.", "type": "string", "example": "Ethnicities" }, "demographics1_footnotes": { "label": "Demographics section 1 footnotes", "description": "Reference(s) for demographics section 1. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "content" }, "demographics1_title1": { "label": "Demographics section 1 title 1", "description": "Titles related to demographics_type1. For example: 'White', 'Black', 'Hispanic'... Additional rows 'demographics1_title1' to 'demographics1_title5' are also available.", "type": "string" }, "demographics_type2": { "label": "Demographics type 2", "description": "A second sub-section header.", "type": "line", "example": "Languages" }, "demographics2_footnotes": { "label": "Demographics section 2 footnotes", "description": "Reference(s) for demographics section 2. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "demographics2_title1": { "label": "Demographics section 2 title 1", "description": "Titles related to 'demographics_type1'. For example: 'English', 'French', 'Arabic'... Additional rows 'demographics2_title2' to 'demographics1_title5' are also available.", "type": "string" }, "demographics2_info1": { "label": "Demographics section 2 info 1", "description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics2_info2' to 'demographics2_info5' are also available.", "type": "content" }, "timezone1": { "label": "Timezone 1", "type": "string", "description": "The place's primary time-zone.", "example": "[[Eastern Standard Time]]" }, "utc_offset": { "label": "UTC offset", "type": "string", "description": "The place's time-zone's offset from UTC.", "example": "+8" }, "timezone_DST": { "label": "Timezone during DST", "type": "string", "description": "The place's time-zone during daylight savings time, if applicable.", "example": "[[Eastern Daylight Time]]" }, "utc_offset_DST": { "label": "UTC offset during DST", "type": "string", "description": "The place's time-zone's UTC offset during daylight savings time, if applicable.", "example": "+9" }, "utc_offset1": { "label": "UTC offset 1", "type": "string", "description": "The place's primary time-zone's offset from UTC.", "example": "-5" }, "timezone1_DST": { "label": "Timezone 1 (during DST)", "type": "string", "description": "The place's primary time-zone during daylight savings time, if applicable.", "example": "[[Eastern Daylight Time]]" }, "utc_offset1_DST": { "label": "UTC offset 1 (during DST)", "type": "string", "description": "The place's primary time-zone's UTC offset during daylight savings time, if applicable.", "example": "-6" }, "timezone2": { "label": "Timezone 2", "description": "A second timezone field for larger areas such as a province.", "type": "string", "example": "[[Central Standard Time]]" }, "utc_offset2": { "label": "UTC offset 2", "type": "string", "description": "The place's secondary time-zone's offset from UTC.", "example": "-6" }, "timezone2_DST": { "label": "Timezone 2 during DST", "type": "string", "description": "The place's secondary time-zone during daylight savings time, if applicable.", "example": "[[Central Daylight Time]]" }, "utc_offset2_DST": { "label": "UTC offset 2 during DST", "type": "string", "description": "The place's secondary time-zone's offset from UTC during daylight savings time, if applicable.", "example": "-7" }, "postal_code_type": { "label": "Postal code type", "description": "Label used for postal code info, e.g. 'ZIP Code'. Defaults to 'Postal code'.", "example": "[[Postal code of China|Postal code]]", "type": "string" }, "postal_code": { "label": "Postal code", "description": "The place's postal code/zip code.", "type": "string", "example": "90210" }, "postal2_code_type": { "label": "Postal code 2 type", "type": "string", "description": "If applicable, the place's second postal code type." }, "postal2_code": { "label": "Postal code 2", "type": "string", "description": "A second postal code of the place, if applicable.", "example": "90007" }, "area_code": { "label": "Area code", "description": "The regions' telephone area code.", "type": "string" }, "area_code_type": { "label": "Area code type", "description": "If left blank/not used, template will default to 'Area code(s)'.", "type": "string" }, "geocode": { "label": "Geocode", "description": "See [[Geocode]].", "type": "string" }, "iso_code": { "label": "ISO 3166 code", "description": "See ISO 3166.", "type": "string" }, "registration_plate": { "label": "Registration/license plate info", "description": "See Vehicle registration plate.", "type": "string" }, "blank_name_sec1": { "label": "Blank name section 1", "description": "Fields used to display other information. The name is displayed in bold on the left side of the infobox.", "type": "string" }, "blank_info_sec1": { "label": "Blank info section 1", "description": "The information associated with the 'blank_name_sec1' heading. The info is displayed on the right side of the infobox in the same row as the name. For an example, see [[Warsaw]].", "type": "content" }, "blank1_name_sec1": { "label": "Blank 1 name section 1", "description": "Up to 7 additional fields 'blank1_name_sec1' ... 'blank7_name_sec1' can be specified.", "type": "string" }, "blank1_info_sec1": { "label": "Blank 1 info section 1", "description": "Up to 7 additional fields 'blank1_info_sec1' ... 'blank7_info_sec1' can be specified.", "type": "content" }, "blank_name_sec2": { "label": "Blank name section 2", "description": "For a second section of blank fields.", "type": "string" }, "blank_info_sec2": { "label": "Blank info section 2", "example": "Beijing", "type": "content", "description": "The information associated with the 'blank_name_sec2' heading. The info is displayed on right side of infobox, in the same row as the name. For an example, see [[Warsaw]]." }, "blank1_name_sec2": { "label": "Blank 1 name section 2", "description": "Up to 7 additional fields 'blank1_name_sec2' ... 'blank7_name_sec2' can be specified.", "type": "string" }, "blank1_info_sec2": { "label": "Blank 1 info section 2", "description": "Up to 7 additional fields 'blank1_info_sec2' ... 'blank7_info_sec2' can be specified.", "type": "content" }, "website": { "label": "Official website in English", "description": "External link to official website. Use the {{URL}} template, thus: {{URL|example.com}}.", "type": "string" }, "footnotes": { "label": "Footnotes", "description": "Text to be displayed at the bottom of the infobox.", "type": "content" }, "translit_lang1_info1": { "label": "Language 1 first transcription ", "description": "Transcription of type 1 in the first other language.", "example": "{{lang|zh|森美兰}}", "type": "line" }, "translit_lang1_type1": { "label": "Language 1 first transcription type", "description": "Type of transcription used in the first language's first transcription.", "example": "[[Chinese Language|Chinese]]", "type": "line" }, "translit_lang1_info2": { "label": "Language 1 second transcription ", "description": "Transcription of type 1 in the first other language.", "example": "{{lang|ta|நெகிரி செம்பிலான்}}", "type": "line" }, "translit_lang1_type2": { "label": "Language 1 second transcription type", "description": "Type of transcription used in the first language's first transcription.", "example": "[[Tamil Language|Tamil]]", "type": "line" }, "demographics1_info1": { "label": "Demographics section 1 info 1", "description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics1_info1' to 'demographics1_info5' are also available.", "type": "content" } } } </templatedata> {{collapse bottom}} ==Calls and redirects == At least {{PAGESINCATEGORY:Templates calling Infobox settlement}} other [[:Category:Templates calling Infobox settlement|templates call this one]]. [{{fullurl:Special:WhatLinksHere/Template:Infobox_settlement|namespace=10&hidetrans=1&hidelinks=1}} Several templates redirect here]. == Tracking categories == # {{clc|Pages using infobox settlement with a dot map}} # {{clc|Pages using infobox settlement with bad settlement type}} # {{clc|Pages using infobox settlement with image map1 but not image map}} # {{clc|Pages using infobox settlement with imprecise region codes}} # {{clc|Pages using infobox settlement with missing country}} # {{clc|Pages using infobox settlement with no map}} # {{clc|Pages using infobox settlement with no coordinates}} # {{clc|Pages using infobox settlement with possible area code list}} # {{clc|Pages using infobox settlement with possible demonym list}} # {{clc|Pages using infobox settlement with possible motto list}} # {{clc|Pages using infobox settlement with possible nickname list}} # {{clc|Pages using infobox settlement with the wikidata parameter}} # {{clc|Pages using infobox settlement with unknown parameters}} # {{clc|Pages using infobox settlement with conflicting parameters}} # {{clc|Pages using infobox settlement with ignored type}} # {{clc|Templates calling Infobox settlement}} <includeonly>{{Sandbox other|| <!--Categories below this line, please; interwikis at Wikidata--> [[Category:Place infobox templates|Settlement]] [[Category:Embeddable templates]] [[Category:Infobox templates using Wikidata]] [[Category:Templates that add a tracking category]] }}</includeonly> 261bc647ae6cc3f45be70aef5b20574388081bf3 Module:Documentation 828 33 66 2023-07-31T17:22:10Z wikipedia>Izno 0 add a comment to make it obvious Scribunto text/plain -- This module implements {{documentation}}. -- Get required modules. local getArgs = require('Module:Arguments').getArgs -- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local p = {} -- Often-used functions. local ugsub = mw.ustring.gsub local format = mw.ustring.format ---------------------------------------------------------------------------- -- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes. ---------------------------------------------------------------------------- local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4) end return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) end p.message = message local function makeWikilink(page, display) if display then return format('[[%s|%s]]', page, display) else return format('[[%s]]', page) end end p.makeWikilink = makeWikilink local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end p.makeCategoryLink = makeCategoryLink local function makeUrlLink(url, display) return format('[%s %s]', url, display) end p.makeUrlLink = makeUrlLink local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end -- 'documentation-toolbar' return format( '<span class="%s">(%s)</span>', message('toolbar-class'), table.concat(ret, ' &#124; ') ) end p.makeToolbar = makeToolbar ---------------------------------------------------------------------------- -- Argument processing ---------------------------------------------------------------------------- local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= '' then return value else return nil end else return value end end }) return p[funcName](args) end end ---------------------------------------------------------------------------- -- Entry points ---------------------------------------------------------------------------- function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end p.main = makeInvokeFunc('_main') function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :attr('role', 'complementary') :attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil) :attr('aria-label', args.heading == '' and 'Documentation' or nil) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', '', {src=cfg['templatestyles'] }) .. tostring(root) end ---------------------------------------------------------------------------- -- Environment settings ---------------------------------------------------------------------------- function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title -- objects and other namespace- or path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]] local env, envFuncs = {}, {} -- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end }) function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the -- same as the subject namespace. However, pages in the Article, File, -- MediaWiki or Category namespaces must have their /doc, /sandbox and -- /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using [[Special:ComparePages]]. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.canonicalUrl( 'Special:ComparePages', { page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end return env end ---------------------------------------------------------------------------- -- Auxiliary templates ---------------------------------------------------------------------------- p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext') function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page' -- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text". local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for [[Template:Foo]] (diff)." local text = '' local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for [[Template:Foo/testcases|test cases]]." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category')) -- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) end function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. return require('Module:Protection banner')._main{ message('protection-reason-edit'), small = true } elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. return require('Module:Protection banner')._main{ action = 'move', small = true } else return nil end end ---------------------------------------------------------------------------- -- Start box ---------------------------------------------------------------------------- p.startBox = makeInvokeFunc('_startBox') function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end return { title = title, docTitle = docTitle, -- View, display, edit, and purge links if /doc exists. viewLinkDisplay = message('view-link-display'), editLinkDisplay = message('edit-link-display'), historyLinkDisplay = message('history-link-display'), purgeLinkDisplay = message('purge-link-display'), preload = preload, createLinkDisplay = message('create-link-display') } end function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create][purge] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]] local docTitle = data.docTitle -- yes, we do intend to purge the template page on which the documentation appears local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay) if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay) local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay) return "&#91;" .. viewLink .. "&#93; &#91;" .. editLink .. "&#93; &#91;" .. historyLink .. "&#93; &#91;" .. purgeLink .. "&#93;" else local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) return "&#91;" .. createLink .. "&#93; &#91;" .. purgeLink .. "&#93;" end return ret end function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {} -- Heading local heading = args.heading -- Blank values are not removed. if heading == '' then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end -- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end -- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') data.links = links end return data end function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :attr('id', 'documentation-heading') :cssText(data.headingStyleText) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end ---------------------------------------------------------------------------- -- Documentation content ---------------------------------------------------------------------------- p.content = makeInvokeFunc('_content') function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. return '\n' .. (content or '') .. '\n' end p.contentTitle = makeInvokeFunc('_contentTitle') function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return '' end end ---------------------------------------------------------------------------- -- End box ---------------------------------------------------------------------------- p.endBox = makeInvokeFunc('_endBox') function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- --]=] -- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end -- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end -- Assemble the link box. local text = '' if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or '') end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template" end end local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done() return '\n' .. tostring(box) end function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above [[Wikipedia:Template documentation|documentation]] -- is [[Help:Transclusion|transcluded]] from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editDisplay = message('edit-link-display') local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay) local historyDisplay = message('history-link-display') local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')} local createDisplay = message('create-link-display') local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end ---------------------------------------------------------------------------- -- Tracking categories ---------------------------------------------------------------------------- function p.addTrackingCategories(env) --[[ -- Check if {{documentation}} is transcluded on a /doc or /testcases page. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have -- {{documentation}} transcluded automatically. --]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = '' if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end return p 268dc89480af10873bfbca5439ae8e61b404f770 Template:Infobox military conflict/doc 10 29 58 2023-08-02T11:17:52Z wikipedia>Cinderella157 0 Undid revision 1168369704 by [[Special:Contributions/Speakwerm|Speakwerm]] ([[User talk:Speakwerm|talk]])Not a test page wikitext text/x-wiki {{Documentation subpage}} {{High-use|16,100}} {{Lua|Module:Infobox military conflict}} __TOC__ ==Usage== {{Infobox military conflict | conflict = Battle of Lützen | partof = the [[Thirty Years' War]] | image = Battle of Lutzen.jpg | alt = Battle of Lutzen by Carl Whalbom depicting King Gustavus Aolphus falling from a horse mortally wounded in a melee | image_size = 300px | caption = The '' '''Battle of Lützen''' '' by [[Carl Wahlbom]] shows the death of King [[Gustavus Adolphus]] on 16 November 1632. | date = 6 November ([[Old Style and New Style dates|O.S.]]) or 16 November ([[Old Style and New Style dates|N.S.]]), 1632 | place = Near [[Lützen]], southwest of [[Leipzig]]<br />(present-day [[Germany]]) | coordinates = {{coord|51|15|N|12|08|E|region:DE_type:city}} | result = Protestant victory <br />(see {{blue|Aftermath}} section) | combatant1 = {{flagicon|Sweden|1562}} [[Swedish Empire|Sweden]]<br />[[Protestant Union]] | combatant2 = {{flag|Holy Roman Empire}}<br/>{{flagicon image|Catholic League (Germany).svg}} [[Catholic League (German)|Catholic League]] | commander1 = {{flagicon|Sweden|1562}} [[Gustavus Adolphus]]{{KIA}}<br/>{{flagicon|Sweden|1562}} [[Dodo zu Innhausen und Knyphausen|Dodo von Knyphausen]]<br/>{{Flagicon|Electorate of Saxony}} [[Bernhard of Saxe-Weimar]]<br/>{{flagicon|Sweden|1562}} [[Robert Munro, 18th Baron of Foulis]] | commander2 = {{flagicon|Holy Roman Empire}} [[Albrecht von Wallenstein]]<br/>{{flagicon|Holy Roman Empire}} [[Heinrich Holk]]<br/>{{flagicon|Holy Roman Empire}} [[Gottfried zu Pappenheim|Count Gottfried zu Pappenheim]]{{DOW}} | strength1 = 12,800 infantry<br />6,200 cavalry<br />60 guns | strength2 = 10,000 infantry<br />7,000 cavalry, plus 3,000 infantry and 2,000 cavalry on arrival<br />24 guns | casualties1 = 3,400 dead and 1,600 wounded or missing | casualties2 = Probably about the same as Swedish casualties{{fakeref|1}} }} A military conflict infobox (sometimes referred to as a warbox) may be used to summarize information about a particular military conflict (a battle, campaign, war, or group of related wars) in a standard manner. Information summarized in an infobox should follow the general guidance for writing a [[Wikipedia:Manual of Style/Lead section|lead section]]. It should not "make claims" or present material not covered by the article. As with a lead section, there is some discretion in citing information in an infobox. The same guidance should be applied to an infobox as given for [[Wikipedia:Manual of Style/Lead section#Citations|citations in a lead section]]. Information in an infobox must conform with [[Wikipedia:Verifiability|verifiability]], [[Wikipedia:Neutral point of view|point-of-view]] and other policies. Information in the infobox should not be "controversial". Refer the reader to an appropriate section in the article or leave the parameter blank rather than make an unsubstantiated or doubtful claim. The infobox should be added using the {{tl|infobox military conflict}} template, as shown below: <div style="width:250px;background:#dddddd;border: 1px solid black;padding:0.5em 1em 0.5em 1em"><syntaxhighlight lang="wikitext"> {{Infobox military conflict | conflict = | width = | partof = | image = | image_size = | alt = | caption = | date = | place = | coordinates = <!--Use the {{coord}} template --> | map_type = | map_relief = | map_size = | map_marksize = | map_caption = | map_label = | territory = | result = | status = | combatants_header = | combatant1 = | combatant2 = | combatant3 = | commander1 = | commander2 = | commander3 = | units1 = | units2 = | units3 = | strength1 = | strength2 = | strength3 = | casualties1 = | casualties2 = | casualties3 = | notes = | campaignbox = }} </syntaxhighlight></div> '''Note''': When using parameters, avoid the ambiguous abbreviation "N/A", and instead use "unknown" or "none". All subjective or qualitative judgements and numerical quantities or statistics must be cited to a reliable source (see [[WP:MILMOS#CITE]]). ===Parameters=== * '''conflict''' – the name of the conflict being described (e.g. "Battle of Lützen" or "World War I"). * '''width''' – ''optional'' – the width of the infobox, e.g. "400px"; defaults to: "315px". * '''partof''' – ''optional'' – the larger conflict containing the event described in the article. For battles or campaigns, this should be the war during which the event takes place; for particularly large wars, this may include a theatre (e.g. "the Eastern Front of World War II"). For wars, the parameter may be used to link to a larger group of wars (e.g. the [[Italian War of 1521–26]] to the [[Italian Wars]]). It may be necessary to insert "the" before the name of the war for proper grammar. * '''image''' – ''optional'' – an image for the warbox. Given in the form <code>Example.jpg</code> * '''image_size''' – ''optional'' – a size for the image * '''alt''' – ''optional'' – [[Wikipedia:Manual of Style/Accessibility/Alternative text for images|Alternative text for image]] that is accessible to [[screen reader]]s to help the [[visually impaired]] * '''caption''' – ''optional'' – the text to be placed below the image. * '''date''' – ''optional'' – the date of the conflict described. Convention is to give the actual date for battles and the years for wars, but this does not always apply. * '''place''' – the location of the conflict. For conflicts covering a wide area, a general description (e.g. "France", or "Europe", or "Worldwide") may be used. * '''coordinates''' &ndash; ''optional'' &ndash; the location of the structure, given as a coordinate pair by using {{tl|coord}} with ''display=inline,title''. Used to display the geographic location of the conflict and the location on a map added with the <code>map_type</code> parameter. * '''map_type''' &ndash; ''optional'' &ndash; the base map to be used for the location map, e.g. "Scotland"; see {{tl|location map}} for more details. * '''map_relief''' &ndash; ''optional'' &ndash; "yes" if the location map is a relief map; see {{tl|location map}} for more details. * '''map_size''' &ndash; ''optional'' &ndash; width of the location map in pixels (px), e.g. "150"; defaults to: "220". * '''map_mark''' &ndash; ''optional'' &ndash; the name of a file to use as the location map marker, e.g. Green_pog.svg; defaults to: "Red_pog.svg". * '''map_marksize''' &ndash; ''optional'' &ndash; width of the location map marker in pixels (px), e.g. "10"; defaults to: "8". * '''map_caption''' &ndash; ''optional'' &ndash; caption displayed below the location map; defaults to "Location within {{{map_type}}}", e.g. "Location within Scotland". * '''map_label''' &ndash; ''optional'' &ndash; the label placed next to the marker on the location map. * '''territory''' – ''optional'' – any changes in territorial control as a result of the conflict; this should not be used for overly lengthy descriptions of the peace settlement. * '''action''' – ''optional'' – In case of Coup d'État, short description of ''modus operandi'', e.g. "...marched over the city...", "...dissolving the Congress of the Republic...", "...take the government hostage ...", "...put the country under military control ...", etc. * '''result''' – ''optional'' – this parameter may use one of two standard terms: "X victory" or "Inconclusive". The term used is for the "immediate" outcome of the "subject" conflict and should reflect what the sources say. In cases where the standard terms do not accurately describe the outcome, a link or note should be made to the section of the article where the result is discussed in detail (such as "See the {{blue|Aftermath}} section"). Such a note can also be used in conjunction with the standard terms but should not be used to conceal an ambiguity in the "immediate" result. Do not introduce non-standard terms like "decisive", "marginal" or "tactical", or contradictory statements like "decisive tactical victory but strategic defeat". Omit this parameter altogether rather than engage in [[WP:NOR|speculation]] about which side won or by how much. * '''status''' – ''optional'' – for ongoing conflicts, the current status of the conflict. This should not be used if a final result (above) is provided. * '''combatants_header''' – ''optional'' – sets the header text for the combatants section. Default is "Belligerents". In case of Coup d'État, use "Government-Insurgents&nbsp;&nbsp;&nbsp;" * '''combatant1'''/'''combatant2'''/'''combatant3''' – ''optional'' – the parties participating in the conflict. This is most commonly the countries whose forces took part in the conflict; however, larger groups (such as alliances or international organizations) or smaller ones (such as particular units, formations, or groups) may be indicated if doing so improves reader understanding. When there is a large number of participants, it may be better to list only the three or four major groups on each side of the conflict, and to describe the rest in the body of the article. The '''combatant3''' field may be used if a conflict has three distinct "sides", and should be left blank on other articles. Combatants should be listed in order of importance to the conflict, be it in terms of military contribution, political clout, or a recognized chain of command. If differing metrics can support alternative lists, then ordering is left to the editors of the particular article. The practice of writing in a "Supported by" subheading is deprecated (see [[Template talk:Infobox military conflict#RfC on "supported by" being used with the belligerent parameter|discussion]]). ** '''combatant1a'''/'''combatant2a'''/'''combatant3a''' – ''optional'' – in cases where the parties significantly changed over the course of the conflict, these subsidiary fields may be used to provide additional rows for the '''combatant''N''''' fields (above). ** '''combatant1b'''/'''combatant2b'''/'''combatant3b''' – ''optional'' – additional row, as above. ** '''combatant1c'''/'''combatant2c'''/'''combatant3c''' – ''optional'' – additional row, as above. ** '''combatant1d'''/'''combatant2d'''/'''combatant3d''' – ''optional'' – additional row, as above. ** '''combatant1e'''/'''combatant2e'''/'''combatant3e''' – ''optional'' – additional row, as above. * '''commander1'''/'''commander2'''/'''commander3''' – ''optional'' – the commanders of the military forces involved. For battles, this should include military commanders (and other officers as necessary). For wars, only prominent or notable leaders should be listed, with an upper limit of about seven per combatant column recommended. Ranks and position titles should be omitted. The {{tl|KIA}} and {{tl|POW}} templates may be included immediately after the names of commanders who were killed in action or surrendered and were taken prisoner, respectively. The '''commander3''' field can only be used if the '''combatant3''' field is set. ** '''commander1a'''/'''commander2a'''/'''commander3a''' – ''optional'' – in cases where the commanders significantly changed over the course of the conflict, these subsidiary fields may be used to provide additional rows for the '''commander''N''''' fields (above). ** '''commander1b'''/'''commander2b'''/'''commander3b''' – ''optional'' – additional row, as above. ** '''commander1c'''/'''commander2c'''/'''commander3c''' – ''optional'' – additional row, as above. ** '''commander1d'''/'''commander2d'''/'''commander3d''' – ''optional'' – additional row, as above. ** '''commander1e'''/'''commander2e'''/'''commander3e''' – ''optional'' – additional row, as above. * '''units1'''/'''units2'''/'''units3''' – ''optional'' – the units or formations involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field. The '''units3''' field can only be used if the '''combatant3''' field is set. * '''strength1'''/'''strength2''' – ''optional'' – the numerical strength of the units involved. :* '''polstrength1'''/'''polstrength2''' – ''optional'' – In case of Coup d'Etat, political organizations that supported the government (1) respective the insurgents (2). :* '''milstrength1'''/'''milstrength2''' – ''optional'' – In case of Coup d'Etat, military units that supported the government (1) respective the insurgents (2). * '''strength3''' – ''optional'' – if '''combatant3''' is set, this is a third strength field identical to the two above; if it is '''''not''''' set, this is an alternate combined field for use where only the total participation in a conflict is known. * '''casualties1'''/'''casualties2''' – ''optional'' – casualties suffered (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Note that this section of the infobox is headed "Casualties and losses". Terms such as "dead" (or "killed"), "wounded", or "captured" should be used in place of abbreviations such as "KIA" or "POW". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc. * '''casualties3''' – ''optional'' – if '''combatant3''' is set, this is a third casualty field identical to the two above; if it is '''''not''''' set, this is an alternate combined field for use where only the total casualties of a conflict are known, or where civilian casualties cannot be directly attributed to either side. * '''notes''' – ''optional'' – optional field for further notes; this should only be used in exceptional circumstances. * '''campaignbox''' – ''optional'' – optional field for appending a [[WP:CAMPAIGN|campaignbox template]] to the bottom of the infobox, which allows both boxes to float as a single element (useful if there are subsequent left floating images, which would otherwise not be able to float above the campaign box); the template must be specified in the format <nowiki>{{Campaignbox XYZ}}</nowiki>.<noinclude> [[Category:WikiProject Military history template instructions|Military conflict infobox]] </noinclude>{{Campaign/doc|noheader=yes}} {{Operational plan/doc|noheader=yes}} ==Microformat== {{UF-hcal-geo}} == TemplateData == {{TemplateData header}} {{collapse top|title=TemplateData}} <templatedata> { "description": "Summarize information about a particular military conflict (a battle, campaign, war, or group of related wars).", "format": "{{_\n| _________________ = _\n}}\n", "params": { "conflict": { "label": "Conflict", "description": "The name of the conflict being described.", "type": "string/line", "required": true }, "width": { "label": "Width", "description": "Width of the infobox.", "type": "string", "default": "315px", "required": false }, "partof": { "label": "Part of", "description": "The larger conflict containing the event described in the article.", "type": "wiki-page-name", "required": false }, "image": { "label": "Image", "description": "An image for the warbox given in the form Example.jpg.", "type": "wiki-file-name", "required": false }, "image_size": { "label": "Image size", "description": "The size of the image", "type": "string", "required": false }, "alt": { "label": "Alt", "description": "Alternative textual description of the image", "type": "string", "required": false }, "caption": { "label": "Caption", "description": "The text to be placed below the image.", "type": "string", "required": false }, "date": { "label": "Date", "description": "The date of the conflict described. Convention is to give the actual date for battles and the years for wars, but this does not always apply.", "type": "string", "required": false }, "place": { "label": "Place", "description": "The location of the conflict.", "type": "string", "required": true }, "coordinates": { "label": "Coordinates", "description": "The location of the structure, given as a coordinate pair by using {{coord}} with display=inline,title.", "type": "string", "required": false }, "map_type": { "label": "Map Type", "description": "The base map to be used for the location map, e.g. \"Scotland\"; see {{location map}} for more details.", "type": "string", "required": false }, "map_relief": { "label": "Map Relief", "description": "\"yes\" if the location map is a relief map.", "type": "string", "required": false }, "map_size": { "label": "Map Size", "description": "Width of the location map in pixels (px).", "type": "number", "default": "220", "required": false }, "map_mark": { "label": "Map Marker", "description": "File to use as the location map marker.", "type": "string", "default": "red_pog.svg", "required": false }, "map_marksize": { "label": "Map Marker Size", "description": "Width of the location map marker in pixels (px).", "type": "number", "default": "8", "required": false }, "map_caption": { "label": "Map Caption", "description": "Caption displayed below the location map.", "type": "string", "default": "Location within {{{map_type}}}", "required": false }, "map_label": { "label": "Map Label", "description": "The label placed next to the marker on the location map.", "type": "string/line", "required": false }, "territory": { "label": "Territory", "description": "Any changes in territorial control as a result of the conflict; this should not be used for overly lengthy descriptions of the peace settlement.", "type": "string", "required": false }, "result": { "label": "Result", "description": "This parameter may use one of two standard terms: \"X victory\" or \"Inconclusive\". The term used is for the \"immediate\" outcome of the \"subject\" conflict and should reflect what the sources say. In cases where the standard terms do not accurately describe the outcome, a link or note should be made to the section of the article where the result is discussed in detail (such as \"See the Aftermath section\"). Such a note can also be used in conjunction with the standard terms but should not be used to conceal an ambiguity in the \"immediate\" result. Do not introduce non-standard terms like \"decisive\", \"marginal\" or \"tactical\", or contradictory statements like \"decisive tactical victory but strategic defeat\". Omit this parameter altogether rather than engage in speculation about which side won or by how much.", "type": "string", "required": false }, "status": { "label": "Status", "description": "For ongoing conflicts, the current status of the conflict.", "type": "string/line", "required": false }, "combatants_header": { "label": "\"Combatants\" Header Text", "description": "Sets the header text for the combatants section.", "type": "string/line", "default": "Belligerents", "required": false }, "combatant1": { "label": "Combatant 1", "description": "A party participating in the conflict.", "type": "string", "required": false }, "combatant2": { "label": "Combatant 2", "description": "A party participating in the conflict.", "type": "string", "required": false }, "combatant3": { "label": "Combatant 3", "description": "A party participating in the conflict. (only if the conflict has three distinct \"sides\")", "type": "string", "required": false }, "combatant1a": { "label": "Combatant 1a", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2a": { "label": "Combatant 2a", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3a": { "label": "Combatant 3a", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "combatant1b": { "label": "Combatant 1b", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2b": { "label": "Combatant 2b", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3b": { "label": "Combatant 3b", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "combatant1c": { "label": "Combatant 1c", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2c": { "label": "Combatant 2c", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3c": { "label": "Combatant 3c", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "combatant1d": { "label": "Combatant 1d", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2d": { "label": "Combatant 2d", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3d": { "label": "Combatant 3d", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "commander1": { "label": "Commander of Combatant 1", "description": "The commanders of the military forces of Combatant (1) involved.", "type": "string", "required": false }, "commander2": { "label": "Commander of Combatant 2", "description": "The commanders of the military forces of Combatant 2 involved.", "type": "string", "required": false }, "commander3": { "label": "Commander of Combatant 3", "description": "The commanders of the military forces of Combatant 3 involved.", "type": "string", "required": false }, "units1": { "label": "Units of Combatant 1", "description": "The units or formations of Combatant 1 involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field.", "type": "string", "required": false }, "units2": { "label": "Units of Combatant 2", "description": "The units or formations of Combatant 2 involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field.", "type": "string", "required": false }, "units3": { "label": "Units of Combatant 3", "description": "The units or formations of Combatant 3 involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field.", "type": "string", "required": false }, "strength1": { "label": "Strength of Combatant 1", "description": "The numerical strength of Combatant 1.", "type": "string", "required": false }, "strength2": { "label": "Strength of Combatant 2", "description": "The numerical strength of Combatant 2.", "type": "string", "required": false }, "strength3": { "label": "Strength of Combatant 3", "description": "If Combatant 3 is set, this field is for the numerical strength of Combatant 3. If Combatant 3 is not set, this is an alternate combined field for use where only the total participation in a conflict is known.", "type": "string", "required": false }, "casualties1": { "label": "Casualties of Combatant 1", "description": "Casualties suffered by Combatant 1 (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Terms such as \"dead\" (or \"killed\"), \"wounded\", or \"captured\" should be used in place of abbreviations such as \"KIA\" or \"POW\". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc.", "type": "string", "required": false }, "casualties2": { "label": "Casualties of Combatant 2", "description": "Casualties suffered by Combatant 2 (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Terms such as \"dead\" (or \"killed\"), \"wounded\", or \"captured\" should be used in place of abbreviations such as \"KIA\" or \"POW\". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc.", "type": "string", "required": false }, "casualties3": { "label": "Casualties of Combatant 3", "description": "If Combatant 3 is set, this field is for the casualties suffered by Combatant 3, (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Terms such as \"dead\" (or \"killed\"), \"wounded\", or \"captured\" should be used in place of abbreviations such as \"KIA\" or \"POW\". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc. If combatant3 is not set, this is an alternate combined field for use where only the total casualties of a conflict are known, or where civilian casualties cannot be directly attributed to either side.", "type": "string", "required": false }, "notes": { "label": "Notes", "description": "Optional field for further notes; this should only be used in exceptional circumstances.", "type": "string", "required": false }, "campaignbox": { "label": "Campaignbox", "description": "Optional field for appending a campaignbox template to the bottom of the infobox, which allows both boxes to float as a single element (useful if there are subsequent left floating images, which would otherwise not be able to float above the campaign box); the template must be specified in the format {{Campaignbox XYZ}}.", "type": "string", "required": false } } }</templatedata> {{Collapse bottom}} ==See also== *{{tl|Infobox military operation}} *{{tl|Infobox civil conflict}} *{{tl|Infobox civilian attack}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:War and conflict infobox templates| ]] [[Category:Templates based on the Infobox Lua module]] }}</includeonly> b7bc1bfd8830e6f3810fed38740c84ef509585dd Main Page 0 1 1 2023-08-02T19:12:07Z MediaWiki default 1 Create main page wikitext text/x-wiki __NOTOC__ == Welcome to {{SITENAME}}! == This Main Page was created automatically and it seems it hasn't been replaced yet. === For the bureaucrat(s) of this wiki === Hello, and welcome to your new wiki! Thank you for choosing Miraheze for the hosting of your wiki, we hope you will enjoy our hosting. You can immediately start working on your wiki or whenever you want. Need help? No problem! We will help you with your wiki as needed. To start, try checking out these helpful links: * [[mw:Special:MyLanguage/Help:Contents|MediaWiki guide]] (e.g. navigation, editing, deleting pages, blocking users) * [[meta:Special:MyLanguage/FAQ|Miraheze FAQ]] * [[meta:Special:MyLanguage/Request features|Request settings changes on your wiki]]. (Extensions, Skin and Logo/Favicon changes should be done through [[Special:ManageWiki]] on your wiki, see [[meta:Special:MyLanguage/ManageWiki|ManageWiki]] for more information.) ==== I still don't understand X! ==== Well, that's no problem. Even if something isn't explained in the documentation/FAQ, we are still happy to help you. You can find us here: * [[meta:Special:MyLanguage/Help center|On our own Miraheze wiki]] * On [[phab:|Phabricator]] * On [https://miraheze.org/discord Discord] * On IRC in #miraheze on irc.libera.chat ([irc://irc.libera.chat/%23miraheze direct link]; [https://web.libera.chat/?channel=#miraheze webchat]) === For visitors of this wiki === Hello, the default Main Page of this wiki (this page) has not yet been replaced by the bureaucrat(s) of this wiki. The bureaucrat(s) might still be working on a Main Page, so please check again later! 21236ac3f8d65e5563b6da6b70815ca6bf1e6616 9 1 2023-08-02T21:13:06Z Plantility 2 Create page properly. wikitext text/x-wiki __NOTOC__ [[File:Ecicon black sm.png|frameless|center|alt=Extended Community icon in black.]] <div align="center"><big>[[Extended Community]]</big> <i>"Where companies, empires, mafias, republics, societies, and other groups have to coexist."<br/> <small>Currently with {{NUMBEROFARTICLES}} pages, {{NUMBEROFEDITS}} edits and {{NUMBEROFFILES}} files.</small></i> <gallery mode="packed-hover"> File:Whitehorse.png|Whitehorse Society|link=Whitehorse_Society File:Equinox Organization.png|Equinox Organization|link=Equinox Organization File:BlackBunnyMafia.png|Black Bunny Mafia|link=Black Bunny Mafia </gallery> </div> == Welcome! == Hello, and welcome to [[Extendipedia]], the Extended Community encyclopedia! Extendipedia seeks to document several concepts and things from the Extended Community, unbiasedly, as they happened, to provide one single source of community-driven truth. Extendipedia may document a person, a group, or even a conflict or battle. Extendipedia's bureaucrats are mostly composed of members of [[Pipekin]]'s Information Board, that established this wiki, and [[Whitehorse Society]] High Command, which began the Extended Community as a whole. == About == {{See also|Extended Community}} The Extended Community is like a continent, and the groups ("extensions") in the it are like countries on that continent. The Extended Community is cluster of closely-connected groups that all share the same political climate due to diplomatic connections, shared history, and the consequences of each group’s leadership. Groups rise and fall in the Extended Community. Some groups may even leave the extended community to either go into exile or to attempt to find a different extended community to participate in. Groups either enter the Extended Community by interaction with groups in it, such as [[Wedton]] or are created by members of it, for example, the [[Soldiers of the Zenith]] == Editing == Before editing in Extendipedia, you will need to familiarize yourself with these useful resources: * The [[Extendipedia:Content Policy|Content Policy]], guiding all rules that all wiki editors must follow, * The [[Extendipedia:Formatting Policy|Formatting Policy]], guiding how pages should look, * And the [[Extendipedia:Sourcing Policy|Sourcing Policy]], on how to properly source and reference in pages. b6bd39407d8ac6815b2db7e0900cf6bf4f7027ec File:Ecicon black.png 6 2 2 2023-08-02T20:07:04Z Plantility 2 Black version of the Extended Community icon. wikitext text/x-wiki == Summary == Black version of the Extended Community icon. b659403fcf0eaae43228c8ea97a769a5194a7c97 File:Ecicon black sm.png 6 3 3 2023-08-02T20:09:23Z Plantility 2 Smaller version of the Extended Community icon to fit within sidebar. wikitext text/x-wiki == Summary == Smaller version of the Extended Community icon to fit within sidebar. 92314635dc5cfd0b19602044ba54552d8a835b96 File:Extendipedia.svg 6 4 4 2023-08-02T20:15:55Z Plantility 2 Icon for the Extendipedia wiki wikitext text/x-wiki == Summary == Icon for the Extendipedia wiki 82aaf493deebd0c495d1293341eb403c42b836c7 File:Whitehorse.png 6 6 6 2023-08-02T20:59:11Z Plantility 2 Icon of the Whitehorse Society wikitext text/x-wiki == Summary == Icon of the Whitehorse Society 23db5dd665f30872ce35cf4557cd4e9dc4d0661d File:Equinox Organization.png 6 7 7 2023-08-02T21:07:45Z Plantility 2 Icon of the Equinox Organization wikitext text/x-wiki == Summary == Icon of the Equinox Organization 6aac8cfbc86270e2cd82b5b83a1361bfee7dadc8 File:BlackBunnyMafia.png 6 8 8 2023-08-02T21:09:38Z Plantility 2 Icon of the Black Bunny Mafia from the Extended Community. wikitext text/x-wiki == Summary == Icon of the Black Bunny Mafia from the Extended Community. b024e0d66b5b0f205ab52f6bead8bbe9a0246f30 MediaWiki:Common.css 8 9 10 2023-08-02T21:21:10Z Plantility 2 Introduce CSS for Infoboxes css text/css /* CSS placed here will be applied to all skins */ .infobox { border: 1px solid #a2a9b1; border-spacing: 3px; background-color: #f8f9fa; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right; font-size: 88%; line-height: 1.5em; width: 22em; } .infobox th { text-align: left; } 7efde9bec75f8f33067830e31050ebf60c6d5522 11 10 2023-08-02T21:55:16Z Plantility 2 css text/css /* CSS placed here will be applied to all skins */ .infobox { border: 1px solid #a2a9b1; border-spacing: 3px; background-color: #f8f9fa; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right; font-size: 88%; line-height: 1.5em; width: 22em; } .infobox th { text-align: left; } .infobox tr { border-bottom: 1px solid #a2a9b1; } 09cd8a0b26fa364b0ae3015494eeb4096b3a14cb 12 11 2023-08-02T21:56:41Z Plantility 2 css text/css /* CSS placed here will be applied to all skins */ .infobox { border: 1px solid #aaa; background-color: #f9f9f9; margin-bottom: 0.5em; margin-left: 1em; padding: .2em; float: right; clear: right; } .infobox tr { vertical-align: top; } .infobox caption { margin-left: inherit; } .infobox.bordered { border-collapse: collapse; } .infobox.bordered td, .infobox.bordered th { border: 1px solid #aaa; } 115043310ebf43182dc02bcb8c82ffb202f1cd89 13 12 2023-08-02T21:58:25Z Plantility 2 css text/css /* CSS placed here will be applied to all skins */ .infobox { border: 1px solid #a2a9b1; border-spacing: 3px; background-color: #f8f9fa; color: black; margin: 0.5em 0 0.5em 1em; padding: 0.2em; float: right; clear: right; font-size: 88%; line-height: 1.5em; width: 22em; } .infobox th { text-align: left; } 7efde9bec75f8f33067830e31050ebf60c6d5522 Module:Infobox 828 22 45 44 2023-08-02T22:42:13Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain local p = {} local args = {} local origArgs = {} local root local empty_row_categories = {} local category_in_empty_row_pattern = '%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*]]' local has_rows = false local lists = { plainlist_t = { patterns = { '^plainlist$', '%splainlist$', '^plainlist%s', '%splainlist%s' }, found = false, styles = 'Plainlist/styles.css' }, hlist_t = { patterns = { '^hlist$', '%shlist$', '^hlist%s', '%shlist%s' }, found = false, styles = 'Hlist/styles.css' } } local function has_list_class(args_to_check) for _, list in pairs(lists) do if not list.found then for _, arg in pairs(args_to_check) do for _, pattern in ipairs(list.patterns) do if mw.ustring.find(arg or '', pattern) then list.found = true break end end if list.found then break end end end end end local function fixChildBoxes(sval, tt) local function notempty( s ) return s and s:match( '%S' ) end if notempty(sval) then local marker = '<span class=special_infobox_marker>' local s = sval -- start moving templatestyles and categories inside of table rows local slast = '' while slast ~= s do slast = s s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(%[%[%s*[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]%s*:[^]]*%]%])', '%2%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>%s*)(\127[^\127]*UNIQ%-%-templatestyles%-%x+%-QINU[^\127]*\127)', '%2%1') end -- end moving templatestyles and categories inside of table rows s = mw.ustring.gsub(s, '(<%s*[Tt][Rr])', marker .. '%1') s = mw.ustring.gsub(s, '(</[Tt][Rr]%s*>)', '%1' .. marker) if s:match(marker) then s = mw.ustring.gsub(s, marker .. '%s*' .. marker, '') s = mw.ustring.gsub(s, '([\r\n]|-[^\r\n]*[\r\n])%s*' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '%s*([\r\n]|-)', '%1') s = mw.ustring.gsub(s, '(</[Cc][Aa][Pp][Tt][Ii][Oo][Nn]%s*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '(<%s*[Tt][Aa][Bb][Ll][Ee][^<>]*>%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '^(%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, '([\r\n]%{|[^\r\n]*[\r\n]%s*)' .. marker, '%1') s = mw.ustring.gsub(s, marker .. '(%s*</[Tt][Aa][Bb][Ll][Ee]%s*>)', '%1') s = mw.ustring.gsub(s, marker .. '(%s*\n|%})', '%1') end if s:match(marker) then local subcells = mw.text.split(s, marker) s = '' for k = 1, #subcells do if k == 1 then s = s .. subcells[k] .. '</' .. tt .. '></tr>' elseif k == #subcells then local rowstyle = ' style="display:none"' if notempty(subcells[k]) then rowstyle = '' end s = s .. '<tr' .. rowstyle ..'><' .. tt .. ' colspan=2>\n' .. subcells[k] elseif notempty(subcells[k]) then if (k % 2) == 0 then s = s .. subcells[k] else s = s .. '<tr><' .. tt .. ' colspan=2>\n' .. subcells[k] .. '</' .. tt .. '></tr>' end end end end -- the next two lines add a newline at the end of lists for the PHP parser -- [[Special:Diff/849054481]] -- remove when [[:phab:T191516]] is fixed or OBE s = mw.ustring.gsub(s, '([\r\n][%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:][^\r\n]*)$', '%1\n') s = mw.ustring.gsub(s, '^([%*#;:])', '\n%1') s = mw.ustring.gsub(s, '^(%{%|)', '\n%1') return s else return sval end end -- Cleans empty tables local function cleanInfobox() root = tostring(root) if has_rows == false then root = mw.ustring.gsub(root, '<table[^<>]*>%s*</table>', '') end end -- Returns the union of the values of two tables, as a sequence. local function union(t1, t2) local vals = {} for k, v in pairs(t1) do vals[v] = true end for k, v in pairs(t2) do vals[v] = true end local ret = {} for k, v in pairs(vals) do table.insert(ret, k) end return ret end -- Returns a table containing the numbers of the arguments that exist -- for the specified prefix. For example, if the prefix was 'data', and -- 'data1', 'data2', and 'data5' exist, it would return {1, 2, 5}. local function getArgNums(prefix) local nums = {} for k, v in pairs(args) do local num = tostring(k):match('^' .. prefix .. '([1-9]%d*)$') if num then table.insert(nums, tonumber(num)) end end table.sort(nums) return nums end -- Adds a row to the infobox, with either a header cell -- or a label/data cell combination. local function addRow(rowArgs) if rowArgs.header and rowArgs.header ~= '_BLANK_' then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class, args.headerclass }) root :tag('tr') :addClass(rowArgs.rowclass) :cssText(rowArgs.rowstyle) :tag('th') :attr('colspan', '2') :addClass('infobox-header') :addClass(rowArgs.class) :addClass(args.headerclass) -- @deprecated next; target .infobox-<name> .infobox-header :cssText(args.headerstyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.header, 'th')) if rowArgs.data then root:wikitext( '[[Category:Pages using infobox templates with ignored data cells]]' ) end elseif rowArgs.data and rowArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ rowArgs.rowclass, rowArgs.class }) local row = root:tag('tr') row:addClass(rowArgs.rowclass) row:cssText(rowArgs.rowstyle) if rowArgs.label then row :tag('th') :attr('scope', 'row') :addClass('infobox-label') -- @deprecated next; target .infobox-<name> .infobox-label :cssText(args.labelstyle) :cssText(rowArgs.rowcellstyle) :wikitext(rowArgs.label) :done() end local dataCell = row:tag('td') dataCell :attr('colspan', not rowArgs.label and '2' or nil) :addClass(not rowArgs.label and 'infobox-full-data' or 'infobox-data') :addClass(rowArgs.class) -- @deprecated next; target .infobox-<name> .infobox(-full)-data :cssText(rowArgs.datastyle) :cssText(rowArgs.rowcellstyle) :wikitext(fixChildBoxes(rowArgs.data, 'td')) else table.insert(empty_row_categories, rowArgs.data or '') end end local function renderTitle() if not args.title then return end has_rows = true has_list_class({args.titleclass}) root :tag('caption') :addClass('infobox-title') :addClass(args.titleclass) -- @deprecated next; target .infobox-<name> .infobox-title :cssText(args.titlestyle) :wikitext(args.title) end local function renderAboveRow() if not args.above then return end has_rows = true has_list_class({ args.aboveclass }) root :tag('tr') :tag('th') :attr('colspan', '2') :addClass('infobox-above') :addClass(args.aboveclass) -- @deprecated next; target .infobox-<name> .infobox-above :cssText(args.abovestyle) :wikitext(fixChildBoxes(args.above,'th')) end local function renderBelowRow() if not args.below then return end has_rows = true has_list_class({ args.belowclass }) root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-below') :addClass(args.belowclass) -- @deprecated next; target .infobox-<name> .infobox-below :cssText(args.belowstyle) :wikitext(fixChildBoxes(args.below,'td')) end local function addSubheaderRow(subheaderArgs) if subheaderArgs.data and subheaderArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ subheaderArgs.rowclass, subheaderArgs.class }) local row = root:tag('tr') row:addClass(subheaderArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-subheader') :addClass(subheaderArgs.class) :cssText(subheaderArgs.datastyle) :cssText(subheaderArgs.rowcellstyle) :wikitext(fixChildBoxes(subheaderArgs.data, 'td')) else table.insert(empty_row_categories, subheaderArgs.data or '') end end local function renderSubheaders() if args.subheader then args.subheader1 = args.subheader end if args.subheaderrowclass then args.subheaderrowclass1 = args.subheaderrowclass end local subheadernums = getArgNums('subheader') for k, num in ipairs(subheadernums) do addSubheaderRow({ data = args['subheader' .. tostring(num)], -- @deprecated next; target .infobox-<name> .infobox-subheader datastyle = args.subheaderstyle, rowcellstyle = args['subheaderstyle' .. tostring(num)], class = args.subheaderclass, rowclass = args['subheaderrowclass' .. tostring(num)] }) end end local function addImageRow(imageArgs) if imageArgs.data and imageArgs.data:gsub(category_in_empty_row_pattern, ''):match('^%S') then has_rows = true has_list_class({ imageArgs.rowclass, imageArgs.class }) local row = root:tag('tr') row:addClass(imageArgs.rowclass) local dataCell = row:tag('td') dataCell :attr('colspan', '2') :addClass('infobox-image') :addClass(imageArgs.class) :cssText(imageArgs.datastyle) :wikitext(fixChildBoxes(imageArgs.data, 'td')) else table.insert(empty_row_categories, imageArgs.data or '') end end local function renderImages() if args.image then args.image1 = args.image end if args.caption then args.caption1 = args.caption end local imagenums = getArgNums('image') for k, num in ipairs(imagenums) do local caption = args['caption' .. tostring(num)] local data = mw.html.create():wikitext(args['image' .. tostring(num)]) if caption then data :tag('div') :addClass('infobox-caption') -- @deprecated next; target .infobox-<name> .infobox-caption :cssText(args.captionstyle) :wikitext(caption) end addImageRow({ data = tostring(data), -- @deprecated next; target .infobox-<name> .infobox-image datastyle = args.imagestyle, class = args.imageclass, rowclass = args['imagerowclass' .. tostring(num)] }) end end -- When autoheaders are turned on, preprocesses the rows local function preprocessRows() if not args.autoheaders then return end local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) local lastheader for k, num in ipairs(rownums) do if args['header' .. tostring(num)] then if lastheader then args['header' .. tostring(lastheader)] = nil end lastheader = num elseif args['data' .. tostring(num)] and args['data' .. tostring(num)]:gsub( category_in_empty_row_pattern, '' ):match('^%S') then local data = args['data' .. tostring(num)] if data:gsub(category_in_empty_row_pattern, ''):match('%S') then lastheader = nil end end end if lastheader then args['header' .. tostring(lastheader)] = nil end end -- Gets the union of the header and data argument numbers, -- and renders them all in order local function renderRows() local rownums = union(getArgNums('header'), getArgNums('data')) table.sort(rownums) for k, num in ipairs(rownums) do addRow({ header = args['header' .. tostring(num)], label = args['label' .. tostring(num)], data = args['data' .. tostring(num)], datastyle = args.datastyle, class = args['class' .. tostring(num)], rowclass = args['rowclass' .. tostring(num)], -- @deprecated next; target .infobox-<name> rowclass rowstyle = args['rowstyle' .. tostring(num)], rowcellstyle = args['rowcellstyle' .. tostring(num)] }) end end local function renderNavBar() if not args.name then return end has_rows = true root :tag('tr') :tag('td') :attr('colspan', '2') :addClass('infobox-navbar') :wikitext(require('Module:Navbar')._navbar{ args.name, mini = 1, }) end local function renderItalicTitle() local italicTitle = args['italic title'] and mw.ustring.lower(args['italic title']) if italicTitle == '' or italicTitle == 'force' or italicTitle == 'yes' then root:wikitext(require('Module:Italic title')._main({})) end end -- Categories in otherwise empty rows are collected in empty_row_categories. -- This function adds them to the module output. It is not affected by -- args.decat because this module should not prevent module-external categories -- from rendering. local function renderEmptyRowCategories() for _, s in ipairs(empty_row_categories) do root:wikitext(s) end end -- Render tracking categories. args.decat == turns off tracking categories. local function renderTrackingCategories() if args.decat == 'yes' then return end if args.child == 'yes' then if args.title then root:wikitext( '[[Category:Pages using embedded infobox templates with the title parameter]]' ) end elseif #(getArgNums('data')) == 0 and mw.title.getCurrentTitle().namespace == 0 then root:wikitext('[[Category:Articles using infobox templates with no data rows]]') end end --[=[ Loads the templatestyles for the infobox. TODO: FINISH loading base templatestyles here rather than in MediaWiki:Common.css. There are 4-5000 pages with 'raw' infobox tables. See [[Mediawiki_talk:Common.css/to_do#Infobox]] and/or come help :). When we do this we should clean up the inline CSS below too. Will have to do some bizarre conversion category like with sidebar. ]=] local function loadTemplateStyles() local frame = mw.getCurrentFrame() local hlist_templatestyles = '' if lists.hlist_t.found then hlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.hlist_t.styles } } end local plainlist_templatestyles = '' if lists.plainlist_t.found then plainlist_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = lists.plainlist_t.styles } } end -- See function description local base_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = 'Module:Infobox/styles.css' } } local templatestyles = '' if args['templatestyles'] then templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['templatestyles'] } } end local child_templatestyles = '' if args['child templatestyles'] then child_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['child templatestyles'] } } end local grandchild_templatestyles = '' if args['grandchild templatestyles'] then grandchild_templatestyles = frame:extensionTag{ name = 'templatestyles', args = { src = args['grandchild templatestyles'] } } end return table.concat({ -- hlist -> plainlist -> base is best-effort to preserve old Common.css ordering. -- this ordering is not a guarantee because the rows of interest invoking -- each class may not be on a specific page hlist_templatestyles, plainlist_templatestyles, base_templatestyles, templatestyles, child_templatestyles, grandchild_templatestyles }) end -- common functions between the child and non child cases local function structure_infobox_common() renderSubheaders() renderImages() preprocessRows() renderRows() renderBelowRow() renderNavBar() renderItalicTitle() renderEmptyRowCategories() renderTrackingCategories() cleanInfobox() end -- Specify the overall layout of the infobox, with special settings if the -- infobox is used as a 'child' inside another infobox. local function _infobox() if args.child ~= 'yes' then root = mw.html.create('table') root :addClass(args.subbox == 'yes' and 'infobox-subbox' or 'infobox') :addClass(args.bodyclass) -- @deprecated next; target .infobox-<name> :cssText(args.bodystyle) has_list_class({ args.bodyclass }) renderTitle() renderAboveRow() else root = mw.html.create() root :wikitext(args.title) end structure_infobox_common() return loadTemplateStyles() .. root end -- If the argument exists and isn't blank, add it to the argument table. -- Blank arguments are treated as nil to match the behaviour of ParserFunctions. local function preprocessSingleArg(argName) if origArgs[argName] and origArgs[argName] ~= '' then args[argName] = origArgs[argName] end end -- Assign the parameters with the given prefixes to the args table, in order, in -- batches of the step size specified. This is to prevent references etc. from -- appearing in the wrong order. The prefixTable should be an array containing -- tables, each of which has two possible fields, a "prefix" string and a -- "depend" table. The function always parses parameters containing the "prefix" -- string, but only parses parameters in the "depend" table if the prefix -- parameter is present and non-blank. local function preprocessArgs(prefixTable, step) if type(prefixTable) ~= 'table' then error("Non-table value detected for the prefix table", 2) end if type(step) ~= 'number' then error("Invalid step value detected", 2) end -- Get arguments without a number suffix, and check for bad input. for i,v in ipairs(prefixTable) do if type(v) ~= 'table' or type(v.prefix) ~= "string" or (v.depend and type(v.depend) ~= 'table') then error('Invalid input detected to preprocessArgs prefix table', 2) end preprocessSingleArg(v.prefix) -- Only parse the depend parameter if the prefix parameter is present -- and not blank. if args[v.prefix] and v.depend then for j, dependValue in ipairs(v.depend) do if type(dependValue) ~= 'string' then error('Invalid "depend" parameter value detected in preprocessArgs') end preprocessSingleArg(dependValue) end end end -- Get arguments with number suffixes. local a = 1 -- Counter variable. local moreArgumentsExist = true while moreArgumentsExist == true do moreArgumentsExist = false for i = a, a + step - 1 do for j,v in ipairs(prefixTable) do local prefixArgName = v.prefix .. tostring(i) if origArgs[prefixArgName] then -- Do another loop if any arguments are found, even blank ones. moreArgumentsExist = true preprocessSingleArg(prefixArgName) end -- Process the depend table if the prefix argument is present -- and not blank, or we are processing "prefix1" and "prefix" is -- present and not blank, and if the depend table is present. if v.depend and (args[prefixArgName] or (i == 1 and args[v.prefix])) then for j,dependValue in ipairs(v.depend) do local dependArgName = dependValue .. tostring(i) preprocessSingleArg(dependArgName) end end end end a = a + step end end -- Parse the data parameters in the same order that the old {{infobox}} did, so -- that references etc. will display in the expected places. Parameters that -- depend on another parameter are only processed if that parameter is present, -- to avoid phantom references appearing in article reference lists. local function parseDataParameters() preprocessSingleArg('autoheaders') preprocessSingleArg('child') preprocessSingleArg('bodyclass') preprocessSingleArg('subbox') preprocessSingleArg('bodystyle') preprocessSingleArg('title') preprocessSingleArg('titleclass') preprocessSingleArg('titlestyle') preprocessSingleArg('above') preprocessSingleArg('aboveclass') preprocessSingleArg('abovestyle') preprocessArgs({ {prefix = 'subheader', depend = {'subheaderstyle', 'subheaderrowclass'}} }, 10) preprocessSingleArg('subheaderstyle') preprocessSingleArg('subheaderclass') preprocessArgs({ {prefix = 'image', depend = {'caption', 'imagerowclass'}} }, 10) preprocessSingleArg('captionstyle') preprocessSingleArg('imagestyle') preprocessSingleArg('imageclass') preprocessArgs({ {prefix = 'header'}, {prefix = 'data', depend = {'label'}}, {prefix = 'rowclass'}, {prefix = 'rowstyle'}, {prefix = 'rowcellstyle'}, {prefix = 'class'} }, 50) preprocessSingleArg('headerclass') preprocessSingleArg('headerstyle') preprocessSingleArg('labelstyle') preprocessSingleArg('datastyle') preprocessSingleArg('below') preprocessSingleArg('belowclass') preprocessSingleArg('belowstyle') preprocessSingleArg('name') -- different behaviour for italics if blank or absent args['italic title'] = origArgs['italic title'] preprocessSingleArg('decat') preprocessSingleArg('templatestyles') preprocessSingleArg('child templatestyles') preprocessSingleArg('grandchild templatestyles') end -- If called via #invoke, use the args passed into the invoking template. -- Otherwise, for testing purposes, assume args are being passed directly in. function p.infobox(frame) if frame == mw.getCurrentFrame() then origArgs = frame:getParent().args else origArgs = frame end parseDataParameters() return _infobox() end -- For calling via #invoke within a template function p.infoboxTemplate(frame) origArgs = {} for k,v in pairs(frame.args) do origArgs[k] = mw.text.trim(v) end parseDataParameters() return _infobox() end return p 0ddb7e5c8426d67cd589b710efb9912ddfb67fea Module:Navbar 828 23 47 46 2023-08-02T22:42:13Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain local p = {} local cfg = mw.loadData('Module:Navbar/configuration') local function get_title_arg(is_collapsible, template) local title_arg = 1 if is_collapsible then title_arg = 2 end if template then title_arg = 'template' end return title_arg end local function choose_links(template, args) -- The show table indicates the default displayed items. -- view, talk, edit, hist, move, watch -- TODO: Move to configuration. local show = {true, true, true, false, false, false} if template then show[2] = false show[3] = false local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6} -- TODO: Consider removing TableTools dependency. for _, v in ipairs(require ('Module:TableTools').compressSparseArray(args)) do local num = index[v] if num then show[num] = true end end end local remove_edit_link = args.noedit if remove_edit_link then show[3] = false end return show end local function add_link(link_description, ul, is_mini, font_style) local l if link_description.url then l = {'[', '', ']'} else l = {'[[', '|', ']]'} end ul:tag('li') :addClass('nv-' .. link_description.full) :wikitext(l[1] .. link_description.link .. l[2]) :tag(is_mini and 'abbr' or 'span') :attr('title', link_description.html_title) :cssText(font_style) :wikitext(is_mini and link_description.mini or link_description.full) :done() :wikitext(l[3]) :done() end local function make_list(title_text, has_brackets, displayed_links, is_mini, font_style) local title = mw.title.new(mw.text.trim(title_text), cfg.title_namespace) if not title then error(cfg.invalid_title .. title_text) end local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or '' -- TODO: Get link_descriptions and show into the configuration module. -- link_descriptions should be easier... local link_descriptions = { { ['mini'] = 'v', ['full'] = 'view', ['html_title'] = 'View this template', ['link'] = title.fullText, ['url'] = false }, { ['mini'] = 't', ['full'] = 'talk', ['html_title'] = 'Discuss this template', ['link'] = talkpage, ['url'] = false }, { ['mini'] = 'e', ['full'] = 'edit', ['html_title'] = 'Edit this template', ['link'] = title:fullUrl('action=edit'), ['url'] = true }, { ['mini'] = 'h', ['full'] = 'hist', ['html_title'] = 'History of this template', ['link'] = title:fullUrl('action=history'), ['url'] = true }, { ['mini'] = 'm', ['full'] = 'move', ['html_title'] = 'Move this template', ['link'] = mw.title.new('Special:Movepage'):fullUrl('target='..title.fullText), ['url'] = true }, { ['mini'] = 'w', ['full'] = 'watch', ['html_title'] = 'Watch this template', ['link'] = title:fullUrl('action=watch'), ['url'] = true } } local ul = mw.html.create('ul') if has_brackets then ul:addClass(cfg.classes.brackets) :cssText(font_style) end for i, _ in ipairs(displayed_links) do if displayed_links[i] then add_link(link_descriptions[i], ul, is_mini, font_style) end end return ul:done() end function p._navbar(args) -- TODO: We probably don't need both fontstyle and fontcolor... local font_style = args.fontstyle local font_color = args.fontcolor local is_collapsible = args.collapsible local is_mini = args.mini local is_plain = args.plain local collapsible_class = nil if is_collapsible then collapsible_class = cfg.classes.collapsible if not is_plain then is_mini = 1 end if font_color then font_style = (font_style or '') .. '; color: ' .. font_color .. ';' end end local navbar_style = args.style local div = mw.html.create():tag('div') div :addClass(cfg.classes.navbar) :addClass(cfg.classes.plainlinks) :addClass(cfg.classes.horizontal_list) :addClass(collapsible_class) -- we made the determination earlier :cssText(navbar_style) if is_mini then div:addClass(cfg.classes.mini) end local box_text = (args.text or cfg.box_text) .. ' ' -- the concatenated space guarantees the box text is separated if not (is_mini or is_plain) then div :tag('span') :addClass(cfg.classes.box_text) :cssText(font_style) :wikitext(box_text) end local template = args.template local displayed_links = choose_links(template, args) local has_brackets = args.brackets local title_arg = get_title_arg(is_collapsible, template) local title_text = args[title_arg] or (':' .. mw.getCurrentFrame():getParent():getTitle()) local list = make_list(title_text, has_brackets, displayed_links, is_mini, font_style) div:node(list) if is_collapsible then local title_text_class if is_mini then title_text_class = cfg.classes.collapsible_title_mini else title_text_class = cfg.classes.collapsible_title_full end div:done() :tag('div') :addClass(title_text_class) :cssText(font_style) :wikitext(args[1]) end local frame = mw.getCurrentFrame() -- hlist -> navbar is best-effort to preserve old Common.css ordering. return frame:extensionTag{ name = 'templatestyles', args = { src = cfg.hlist_templatestyles } } .. frame:extensionTag{ name = 'templatestyles', args = { src = cfg.templatestyles } } .. tostring(div:done()) end function p.navbar(frame) return p._navbar(require('Module:Arguments').getArgs(frame)) end return p 79f907e59eaa8bbf8dd50bb751933ebeaaa7eb17 Module:InfoboxImage 828 24 49 48 2023-08-02T22:42:14Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain -- Inputs: -- image - Can either be a bare filename (with or without the File:/Image: prefix) or a fully formatted image link -- page - page to display for multipage images (DjVu) -- size - size to display the image -- maxsize - maximum size for image -- sizedefault - default size to display the image if size param is blank -- alt - alt text for image -- title - title text for image -- border - set to yes if border -- center - set to yes, if the image has to be centered -- upright - upright image param -- suppressplaceholder - if yes then checks to see if image is a placeholder and suppresses it -- link - page to visit when clicking on image -- class - HTML classes to add to the image -- Outputs: -- Formatted image. -- More details available at the "Module:InfoboxImage/doc" page local i = {}; local placeholder_image = { "Blue - Replace this image female.svg", "Blue - Replace this image male.svg", "Female no free image yet.png", "Flag of None (square).svg", "Flag of None.svg", "Flag of.svg", "Green - Replace this image female.svg", "Green - Replace this image male.svg", "Image is needed female.svg", "Image is needed male.svg", "Location map of None.svg", "Male no free image yet.png", "Missing flag.png", "No flag.svg", "No free portrait.svg", "No portrait (female).svg", "No portrait (male).svg", "Red - Replace this image female.svg", "Red - Replace this image male.svg", "Replace this image female (blue).svg", "Replace this image female.svg", "Replace this image male (blue).svg", "Replace this image male.svg", "Silver - Replace this image female.svg", "Silver - Replace this image male.svg", "Replace this image.svg", "Cricket no pic.png", "CarersLogo.gif", "Diagram Needed.svg", "Example.jpg", "Image placeholder.png", "No male portrait.svg", "Nocover-upload.png", "NoDVDcover copy.png", "Noribbon.svg", "No portrait-BFD-test.svg", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Sin bandera.svg", "Sin escudo.svg", "Replace this image - temple.png", "Replace this image butterfly.png", "Replace this image.svg", "Replace this image1.svg", "Resolution angle.png", "Image-No portrait-text-BFD-test.svg", "Insert image here.svg", "No image available.png", "NO IMAGE YET square.png", "NO IMAGE YET.png", "No Photo Available.svg", "No Screenshot.svg", "No-image-available.jpg", "Null.png", "PictureNeeded.gif", "Place holder.jpg", "Unbenannt.JPG", "UploadACopyrightFreeImage.svg", "UploadAnImage.gif", "UploadAnImage.svg", "UploadAnImageShort.svg", "CarersLogo.gif", "Diagram Needed.svg", "No male portrait.svg", "NoDVDcover copy.png", "Placeholder barnstar ribbon.png", "Project Trains no image.png", "Image-request.png", "Noimage.gif", } function i.IsPlaceholder(image) -- change underscores to spaces image = mw.ustring.gsub(image, "_", " "); assert(image ~= nil, 'mw.ustring.gsub(image, "_", " ") must not return nil') -- if image starts with [[ then remove that and anything after | if mw.ustring.sub(image,1,2) == "[[" then image = mw.ustring.sub(image,3); image = mw.ustring.gsub(image, "([^|]*)|.*", "%1"); assert(image ~= nil, 'mw.ustring.gsub(image, "([^|]*)|.*", "%1") must not return nil') end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); assert(image ~= nil, "mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1') must not return nil") -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end -- Trim spaces image = mw.ustring.gsub(image, '^[ ]*(.-)[ ]*$', '%1'); -- capitalise first letter image = mw.ustring.upper(mw.ustring.sub(image,1,1)) .. mw.ustring.sub(image,2); for i,j in pairs(placeholder_image) do if image == j then return true end end return false end function i.InfoboxImage(frame) local image = frame.args["image"]; if image == "" or image == nil then return ""; end if image == "&nbsp;" then return image; end if frame.args["suppressplaceholder"] ~= "no" then if i.IsPlaceholder(image) == true then return ""; end end if mw.ustring.lower(mw.ustring.sub(image,1,5)) == "http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[[http:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,6)) == "https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,7)) == "[https:" then return ""; end if mw.ustring.lower(mw.ustring.sub(image,1,8)) == "[[https:" then return ""; end if mw.ustring.sub(image,1,2) == "[[" then -- search for thumbnail images and add to tracking cat if found local cat = ""; if mw.title.getCurrentTitle().namespace == 0 and (mw.ustring.find(image, "|%s*thumb%s*[|%]]") or mw.ustring.find(image, "|%s*thumbnail%s*[|%]]")) then cat = "[[Category:Pages using infoboxes with thumbnail images]]"; end return image .. cat; elseif mw.ustring.sub(image,1,2) == "{{" and mw.ustring.sub(image,1,3) ~= "{{{" then return image; elseif mw.ustring.sub(image,1,1) == "<" then return image; elseif mw.ustring.sub(image,1,5) == mw.ustring.char(127).."UNIQ" then -- Found strip marker at begining, so pass don't process at all return image; elseif mw.ustring.sub(image,4,9) == "`UNIQ-" then -- Found strip marker at begining, so pass don't process at all return image; else local result = ""; local page = frame.args["page"]; local size = frame.args["size"]; local maxsize = frame.args["maxsize"]; local sizedefault = frame.args["sizedefault"]; local alt = frame.args["alt"]; local link = frame.args["link"]; local title = frame.args["title"]; local border = frame.args["border"]; local upright = frame.args["upright"] or ""; local thumbtime = frame.args["thumbtime"] or ""; local center = frame.args["center"]; local class = frame.args["class"]; -- remove prefix if exists local allNames = mw.site.namespaces[6].aliases allNames[#allNames + 1] = mw.site.namespaces[6].name allNames[#allNames + 1] = mw.site.namespaces[6].canonicalName for i, name in ipairs(allNames) do if mw.ustring.lower(mw.ustring.sub(image, 1, mw.ustring.len(name) + 1)) == mw.ustring.lower(name .. ":") then image = mw.ustring.sub(image, mw.ustring.len(name) + 2); break end end if maxsize ~= "" and maxsize ~= nil then -- if no sizedefault then set to maxsize if sizedefault == "" or sizedefault == nil then sizedefault = maxsize end -- check to see if size bigger than maxsize if size ~= "" and size ~= nil then local sizenumber = tonumber(mw.ustring.match(size,"%d*")) or 0; local maxsizenumber = tonumber(mw.ustring.match(maxsize,"%d*")) or 0; if sizenumber>maxsizenumber and maxsizenumber>0 then size = maxsize; end end end -- add px to size if just a number if (tonumber(size) or 0) > 0 then size = size .. "px"; end -- add px to sizedefault if just a number if (tonumber(sizedefault) or 0) > 0 then sizedefault = sizedefault .. "px"; end result = "[[File:" .. image; if page ~= "" and page ~= nil then result = result .. "|page=" .. page; end if size ~= "" and size ~= nil then result = result .. "|" .. size; elseif sizedefault ~= "" and sizedefault ~= nil then result = result .. "|" .. sizedefault; else result = result .. "|frameless"; end if center == "yes" then result = result .. "|center" end if alt ~= "" and alt ~= nil then result = result .. "|alt=" .. alt; end if link ~= "" and link ~= nil then result = result .. "|link=" .. link; end if border == "yes" then result = result .. "|border"; end if upright == "yes" then result = result .. "|upright"; elseif upright ~= "" then result = result .. "|upright=" .. upright; end if thumbtime ~= "" then result = result .. "|thumbtime=" .. thumbtime; end if class ~= nil and class ~= "" then result = result .. "|class=" .. class; end -- if alt value is a keyword then do not use as a description if alt == "thumbnail" or alt == "thumb" or alt == "frameless" or alt == "left" or alt == "center" or alt == "right" or alt == "upright" or alt == "border" or mw.ustring.match(alt or "", '^[0-9]*px$', 1) ~= nil then alt = nil; end if title ~= "" and title ~= nil then -- does title param contain any templatestyles? If yes then set to blank. if mw.ustring.match(frame:preprocess(title), 'UNIQ%-%-templatestyles', 1) ~= nil then title = nil; end end if title ~= "" and title ~= nil then result = result .. "|" .. title; end result = result .. "]]"; return result; end end return i; 0ee5fe75ba239fc5c9cedc81ca11bdc0be068542 Module:Check for unknown parameters 828 25 51 50 2023-08-02T22:42:14Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain -- This module may be used to compare the arguments passed to the parent -- with a list of arguments, returning a specified result if an argument is -- not on the list local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end local function clean(text) -- Return text cleaned for display and truncated if too long. -- Strip markers are replaced with dummy text representing the original wikitext. local pos, truncated local function truncate(text) if truncated then return '' end if mw.ustring.len(text) > 25 then truncated = true text = mw.ustring.sub(text, 1, 25) .. '...' end return mw.text.nowiki(text) end local parts = {} for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') do pos = remainder table.insert(parts, truncate(before) .. '&lt;' .. tag .. '&gt;...&lt;/' .. tag .. '&gt;') end table.insert(parts, truncate(text:sub(pos or 1))) return table.concat(parts) end function p._check(args, pargs) if type(args) ~= "table" or type(pargs) ~= "table" then -- TODO: error handling return end -- create the list of known args, regular expressions, and the return string local knownargs = {} local regexps = {} for k, v in pairs(args) do if type(k) == 'number' then v = trim(v) knownargs[v] = 1 elseif k:find('^regexp[1-9][0-9]*$') then table.insert(regexps, '^' .. v .. '$') end end -- loop over the parent args, and make sure they are on the list local ignoreblank = isnotempty(args['ignoreblank']) local showblankpos = isnotempty(args['showblankpositional']) local values = {} for k, v in pairs(pargs) do if type(k) == 'string' and knownargs[k] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(k, regexp) then knownflag = true break end end if not knownflag and ( not ignoreblank or isnotempty(v) ) then table.insert(values, clean(k)) end elseif type(k) == 'number' and knownargs[tostring(k)] == nil then local knownflag = false for _, regexp in ipairs(regexps) do if mw.ustring.match(tostring(k), regexp) then knownflag = true break end end if not knownflag and ( showblankpos or isnotempty(v) ) then table.insert(values, k .. ' = ' .. clean(v)) end end end -- add results to the output tables local res = {} if #values > 0 then local unknown_text = args['unknown'] or 'Found _VALUE_, ' if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" then local preview_text = args['preview'] if isnotempty(preview_text) then preview_text = require('Module:If preview')._warning({preview_text}) elseif preview == nil then preview_text = unknown_text end unknown_text = preview_text end for _, v in pairs(values) do -- Fix odd bug for | = which gets stripped to the empty string and -- breaks category links if v == '' then v = ' ' end -- avoid error with v = 'example%2' ("invalid capture index") local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v}) table.insert(res, r) end end return table.concat(res) end function p.check(frame) local args = frame.args local pargs = frame:getParent().args return p._check(args, pargs) end return p 93db6d115d4328d2a5148bb42959105e367b663e Module:If empty 828 26 53 52 2023-08-02T22:42:14Z Plantility 2 1 revision imported: Import all infoboxes from Wikipedia (due to laziness) Scribunto text/plain local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false}) for k,v in ipairs(args) do if v ~= '' then return v end end end return p 4790391408957dea3ff9f453834c05f6b379a45c Template:Infobox settlement/doc 10 27 55 54 2023-08-02T22:43:51Z Plantility 2 1 revision imported: Import more infoboxes from Wikipedia (due to laziness) wikitext text/x-wiki {{Documentation subpage}} <!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])--> {{Auto short description}} {{High-use}} {{Lua|Module:Infobox|Module:InfoboxImage|Module:Coordinates|Module:Check for unknown parameters|Module:Settlement short description}} {{Uses TemplateStyles|Template:Infobox settlement/styles.css}} {{Uses Wikidata|P41|P94|P158|P625|P856}} This template should be used to produce an [[WP:Infobox|Infobox]] for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, et cetera—in fact, any subdivision below the level of a country, for which {{tl|Infobox country}} should be used. Parameters are described in the table below. For questions, see the [[Template talk:Infobox settlement|talk page]]. For a US city guideline, see [[WP:USCITIES]]. The template is aliased or used as a sub-template for several infobox front-end templates. ==Usage== * '''Important''': Please enter all numeric values in a raw, unformatted fashion. References and {{tl|citation needed}} tags are to be included in their respective section footnotes field. Numeric values that are not "raw" may create an "Expression error". Raw values will be automatically formatted by the template. If you find a raw value is not formatted in your usage of the template, please post a notice on the discussion page for this template. * An expression error may also occur when any coordinate parameter has a value, but one or more coordinate parameters are blank or invalid. Basic blank template, ready to cut and paste. See the next section for a copy of the template with all parameters and comments. See the table below that for a full description of each parameter. ===Using metric units=== <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox settlement |name = |native_name = <!-- Settlement name in local language(s), if different from the English name --> |native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> |settlement_type = |image_skyline = |imagesize = |image_alt = |image_caption = |image_flag = |flag_alt = |image_seal = |seal_alt = |image_shield = |shield_alt = |etymology = |nickname = |motto = |image_map = |map_alt = |map_caption = |pushpin_map = |pushpin_map_alt = |pushpin_map_caption = |pushpin_mapsize = |pushpin_label_position = |coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} --> |coor_pinpoint = |coordinates_footnotes = |subdivision_type = Country |subdivision_name = |subdivision_type1 = |subdivision_name1 = |subdivision_type2 = |subdivision_name2 = |subdivision_type3 = |subdivision_name3 = |established_title = |established_date = |founder = |seat_type = |seat = |government_footnotes = |government_type = |governing_body = |leader_party = |leader_title = |leader_name = |leader_title1 = |leader_name1 = |leader_title2 = |leader_name2 = |leader_title3 = |leader_name3 = |leader_title4 = |leader_name4 = |unit_pref = Metric <!-- ALL fields with measurements have automatic unit conversion --> <!-- for references: use <ref> tags --> |area_footnotes = |area_urban_footnotes = <!-- <ref> </ref> --> |area_rural_footnotes = <!-- <ref> </ref> --> |area_metro_footnotes = <!-- <ref> </ref> --> |area_note = |area_water_percent = |area_rank = |area_blank1_title = |area_blank2_title = <!-- square kilometers --> |area_total_km2 = |area_land_km2 = |area_water_km2 = |area_urban_km2 = |area_rural_km2 = |area_metro_km2 = |area_blank1_km2 = |area_blank2_km2 = <!-- hectares --> |area_total_ha = |area_land_ha = |area_water_ha = |area_urban_ha = |area_rural_ha = |area_metro_ha = |area_blank1_ha = |area_blank2_ha = |length_km = |width_km = |dimensions_footnotes = |elevation_footnotes = |elevation_m = |population_footnotes = |population_as_of = |population_total = |population_density_km2 = auto |population_note = |population_demonym = |timezone1 = |utc_offset1 = |timezone1_DST = |utc_offset1_DST = |postal_code_type = |postal_code = |area_code_type = |area_code = |area_codes = <!-- for multiple area codes --> |iso_code = |website = <!-- {{URL|example.com}} --> |module = |footnotes = }} </syntaxhighlight> ===Using non-metric units=== <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox settlement |name = |native_name = |native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> |settlement_type = |image_skyline = |imagesize = |image_alt = |image_caption = |image_flag = |flag_alt = |image_seal = |seal_alt = |image_shield = |shield_alt = |etymology = |nickname = |motto = |image_map = |map_alt = |map_caption = |pushpin_map = |pushpin_map_alt = |pushpin_map_caption = |pushpin_label_position = |coordinates = <!-- {{coord|latitude|longitude|type:city|display=inline,title}} --> |coor_pinpoint = |coordinates_footnotes = |subdivision_type = Country |subdivision_name = |subdivision_type1 = |subdivision_name1 = |subdivision_type2 = |subdivision_name2 = |subdivision_type3 = |subdivision_name3 = |established_title = |established_date = |founder = |seat_type = |seat = |government_footnotes = |leader_party = |leader_title = |leader_name = |unit_pref = US<!-- or UK --> <!-- ALL fields with measurements have automatic unit conversion --> <!-- for references: use <ref> tags --> |area_footnotes = |area_urban_footnotes = <!-- <ref> </ref> --> |area_rural_footnotes = <!-- <ref> </ref> --> |area_metro_footnotes = <!-- <ref> </ref> --> |area_note = |area_water_percent = |area_rank = |area_blank1_title = |area_blank2_title = <!-- square miles --> |area_total_sq_mi = |area_land_sq_mi = |area_water_sq_mi = |area_urban_sq_mi = |area_rural_sq_mi = |area_metro_sq_mi = |area_blank1_sq_mi = |area_blank2_sq_mi = <!-- acres --> |area_total_acre = |area_land_acre = |area_water_acre = |area_urban_acre = |area_rural_acre = |area_metro_acre = |area_blank1_acre = |area_blank2_acre = |length_mi = |width_mi = |dimensions_footnotes = |elevation_footnotes = |elevation_ft = |population_footnotes = |population_as_of = |population_total = |population_density_sq_mi = auto |population_note = |population_demonym = |timezone1 = |utc_offset1 = |timezone1_DST = |utc_offset1_DST = |postal_code_type = |postal_code = |area_code_type = |area_code = |iso_code = |website = <!-- {{URL|example.com}} --> |module = |footnotes = }} </syntaxhighlight> ===Short version=== <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox settlement |name = |native_name = |native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> |settlement_type = |image_skyline = |imagesize = |image_alt = |image_caption = |etymology = |nickname = |coordinates = <!-- {{Coord}} --> |population_total = |subdivision_type = Country |subdivision_name = |subdivision_type1 = |subdivision_name1 = |subdivision_type2 = |subdivision_name2 = |website = <!-- {{URL|example.com}} --> }} </syntaxhighlight> ===Complete empty syntax, with comments=== This copy of the template lists all parameters except for some of the repeating numbered parameters which are noted in the comments. Comments here should be brief; see the table below for full descriptions of each parameter. <syntaxhighlight lang="wikitext" style="overflow:auto;"> {{Infobox settlement | name = <!-- at least one of the first two fields must be filled in --> | official_name = | native_name = <!-- if different from the English name --> | native_name_lang = <!-- ISO 639-1 code e.g. "fr" for French. If more than one, use {{lang}} instead --> | other_name = | settlement_type = <!-- such as Town, Village, City, Borough etc. --> <!-- transliteration(s) --> | translit_lang1 = | translit_lang1_type = | translit_lang1_info = | translit_lang1_type1 = | translit_lang1_info1 = | translit_lang1_type2 = | translit_lang1_info2 = <!-- etc., up to translit_lang1_type6 / translit_lang1_info6 --> | translit_lang2 = | translit_lang2_type = | translit_lang2_info = | translit_lang2_type1 = | translit_lang2_info1 = | translit_lang2_type2 = | translit_lang2_info2 = <!-- etc., up to translit_lang2_type6 / translit_lang2_info6 --> <!-- images, nickname, motto --> | image_skyline = | imagesize = | image_alt = | image_caption = | image_flag = | flag_size = | flag_alt = | flag_border = | flag_link = | image_seal = | seal_size = | seal_alt = | seal_link = | seal_type = | image_shield = | shield_size = | shield_alt = | shield_link = | image_blank_emblem = | blank_emblem_type = | blank_emblem_size = | blank_emblem_alt = | blank_emblem_link = | etymology = | nickname = | nicknames = | motto = | mottoes = | anthem = <!-- maps and coordinates --> | image_map = | mapsize = | map_alt = | map_caption = | image_map1 = | mapsize1 = | map_alt1 = | map_caption1 = | pushpin_map = <!-- name of a location map as per Template:Location_map --> | pushpin_mapsize = | pushpin_map_alt = | pushpin_map_caption = | pushpin_map_caption_notsmall = | pushpin_label = <!-- only necessary if "name" or "official_name" are too long --> | pushpin_label_position = <!-- position of the pushpin label: left, right, top, bottom, none --> | pushpin_outside = | pushpin_relief = | pushpin_image = | pushpin_overlay = | coordinates = <!-- {{Coord}} --> | coor_pinpoint = <!-- to specify exact location of coordinates (was coor_type) --> | coordinates_footnotes = <!-- for references: use <ref> tags --> | grid_name = <!-- name of a regional grid system --> | grid_position = <!-- position on the regional grid system --> <!-- location --> | subdivision_type = Country | subdivision_name = <!-- the name of the country --> | subdivision_type1 = | subdivision_name1 = | subdivision_type2 = | subdivision_name2 = <!-- etc., subdivision_type6 / subdivision_name6 --> <!-- established --> | established_title = <!-- Founded --> | established_date = <!-- requires established_title= --> | established_title1 = <!-- Incorporated (town) --> | established_date1 = <!-- requires established_title1= --> | established_title2 = <!-- Incorporated (city) --> | established_date2 = <!-- requires established_title2= --> | established_title3 = | established_date3 = <!-- requires established_title3= --> | established_title4 = | established_date4 = <!-- requires established_title4= --> | established_title5 = | established_date5 = <!-- requires established_title5= --> | established_title6 = | established_date6 = <!-- requires established_title6= --> | established_title7 = | established_date7 = <!-- requires established_title7= --> | extinct_title = | extinct_date = | founder = | named_for = <!-- seat, smaller parts --> | seat_type = <!-- defaults to: Seat --> | seat = | seat1_type = <!-- defaults to: Former seat --> | seat1 = | parts_type = <!-- defaults to: Boroughs --> | parts_style = <!-- list, coll (collapsed list), para (paragraph format) --> | parts = <!-- parts text, or header for parts list --> | p1 = | p2 = <!-- etc., up to p50: for separate parts to be listed--> <!-- government type, leaders --> | government_footnotes = <!-- for references: use <ref> tags --> | government_type = | governing_body = | leader_party = | leader_title = | leader_name = <!-- add &amp;nbsp; (no-break space) to disable automatic links --> | leader_title1 = | leader_name1 = <!-- etc., up to leader_title4 / leader_name4 --> <!-- display settings --> | total_type = <!-- to set a non-standard label for total area and population rows --> | unit_pref = <!-- enter: Imperial, to display imperial before metric --> <!-- area --> | area_footnotes = <!-- for references: use <ref> tags --> | dunam_link = <!-- If dunams are used, this specifies which dunam to link. --> | area_total_km2 = <!-- ALL fields with measurements have automatic unit conversion --> | area_total_sq_mi = <!-- see table @ Template:Infobox settlement for details --> | area_total_ha = | area_total_acre = | area_total_dunam = <!-- used in Middle East articles only --> | area_land_km2 = | area_land_sq_mi = | area_land_ha = | area_land_acre = | area_land_dunam = <!-- used in Middle East articles only --> | area_water_km2 = | area_water_sq_mi = | area_water_ha = | area_water_acre = | area_water_dunam = <!-- used in Middle East articles only --> | area_water_percent = | area_urban_footnotes = <!-- for references: use <ref> tags --> | area_urban_km2 = | area_urban_sq_mi = | area_urban_ha = | area_urban_acre = | area_urban_dunam = <!-- used in Middle East articles only --> | area_rural_footnotes = <!-- for references: use <ref> tags --> | area_rural_km2 = | area_rural_sq_mi = | area_rural_ha = | area_rural_acre = | area_rural_dunam = <!-- used in Middle East articles only --> | area_metro_footnotes = <!-- for references: use <ref> tags --> | area_metro_km2 = | area_metro_sq_mi = | area_metro_ha = | area_metro_acre = | area_metro_dunam = <!-- used in Middle East articles only --> | area_rank = | area_blank1_title = | area_blank1_km2 = | area_blank1_sq_mi = | area_blank1_ha = | area_blank1_acre = | area_blank1_dunam = <!-- used in Middle East articles only --> | area_blank2_title = | area_blank2_km2 = | area_blank2_sq_mi = | area_blank2_ha = | area_blank2_acre = | area_blank2_dunam = <!-- used in Middle East articles only --> | area_note = <!-- dimensions --> | dimensions_footnotes = <!-- for references: use <ref> tags --> | length_km = | length_mi = | width_km = | width_mi = <!-- elevation --> | elevation_footnotes = <!-- for references: use <ref> tags --> | elevation_m = | elevation_ft = | elevation_point = <!-- for denoting the measurement point --> | elevation_max_footnotes = <!-- for references: use <ref> tags --> | elevation_max_m = | elevation_max_ft = | elevation_max_point = <!-- for denoting the measurement point --> | elevation_max_rank = | elevation_min_footnotes = <!-- for references: use <ref> tags --> | elevation_min_m = | elevation_min_ft = | elevation_min_point = <!-- for denoting the measurement point --> | elevation_min_rank = <!-- population --> | population_footnotes = <!-- for references: use <ref> tags --> | population_as_of = | population_total = | pop_est_footnotes = | pop_est_as_of = | population_est = | population_rank = | population_density_km2 = <!-- for automatic calculation of any density field, use: auto --> | population_density_sq_mi = | population_urban_footnotes = | population_urban = | population_density_urban_km2 = | population_density_urban_sq_mi = | population_rural_footnotes = | population_rural = | population_density_rural_km2 = | population_density_rural_sq_mi = | population_metro_footnotes = | population_metro = | population_density_metro_km2 = | population_density_metro_sq_mi = | population_density_rank = | population_blank1_title = | population_blank1 = | population_density_blank1_km2 = | population_density_blank1_sq_mi = | population_blank2_title = | population_blank2 = | population_density_blank2_km2 = | population_density_blank2_sq_mi = | population_demonym = <!-- demonym, e.g. Liverpudlian for someone from Liverpool --> | population_demonyms = | population_note = <!-- demographics (section 1) --> | demographics_type1 = | demographics1_footnotes = <!-- for references: use <ref> tags --> | demographics1_title1 = | demographics1_info1 = <!-- etc., up to demographics1_title7 / demographics1_info7 --> <!-- demographics (section 2) --> | demographics_type2 = | demographics2_footnotes = <!-- for references: use <ref> tags --> | demographics2_title1 = | demographics2_info1 = <!-- etc., up to demographics2_title10 / demographics2_info10 --> <!-- time zone(s) --> | timezone_link = | timezone1_location = | timezone1 = | utc_offset1 = | timezone1_DST = | utc_offset1_DST = | timezone2_location = | timezone2 = | utc_offset2 = | timezone2_DST = | utc_offset2_DST = | timezone3_location = | timezone3 = | utc_offset3 = | timezone3_DST = | utc_offset3_DST = | timezone4_location = | timezone4 = | utc_offset4 = | timezone4_DST = | utc_offset4_DST = | timezone5_location = | timezone5 = | utc_offset5 = | timezone5_DST = | utc_offset5_DST = <!-- postal codes, area code --> | postal_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... --> | postal_code = | postal2_code_type = <!-- enter ZIP Code, Postcode, Post code, Postal code... --> | postal2_code = | area_code_type = <!-- defaults to: Area code(s) --> | area_code = | area_codes = | geocode = | iso_code = | registration_plate_type = | registration_plate = | code1_name = | code1_info = | code2_name = | code2_info = <!-- blank fields (section 1) --> | blank_name_sec1 = | blank_info_sec1 = | blank1_name_sec1 = | blank1_info_sec1 = | blank2_name_sec1 = | blank2_info_sec1 = <!-- etc., up to blank7_name_sec1 / blank7_info_sec1 --> <!-- blank fields (section 2) --> | blank_name_sec2 = | blank_info_sec2 = | blank1_name_sec2 = | blank1_info_sec2 = | blank2_name_sec2 = | blank2_info_sec2 = <!-- etc., up to blank7_name_sec2 / blank7_info_sec2 --> <!-- website, footnotes --> | website = <!-- {{URL|example.com}} --> | module = | footnotes = }} </syntaxhighlight> ==Parameter names and descriptions== {| class="wikitable" style="background: white" | colspan=3 style="background: orange; text-align: center;" | ===Name and transliteration=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" | '''name''' || optional || This is the usual name in English. If it's not specified, the infobox will use the '''official_name''' as a title unless this too is missing, in which case the page name will be used. |- style="vertical-align:top;" | '''official_name''' || optional || The official name in English. Avoid using '''official_name''' if it leads to redundancy with '''name''' and '''settlement_type'''. Use '''official_name''' if the official name is unusual or cannot be simply deduced from the name and settlement type. |- style="vertical-align:top;" | '''native_name''' || optional || Name in the local language, if different from '''name''', and if not English. This will display below the name/official name. |- style="vertical-align:top;" | '''native_name_lang''' || optional || Use [[List of ISO 639-1 codes|ISO 639-1 code]], e.g. "fr" for French. If there is more than one native name, in different languages, enter those names using {{tl|lang}}, instead. |- style="vertical-align:top;" | '''other_name''' || optional || For places with a former or more common name like Bombay or Saigon |- style="vertical-align:top;" | '''settlement_type''' || optional || Any type can be entered, such as City, Town, Village, Hamlet, Municipality, Reservation, etc. If set, will be displayed under the names. Might also be used as a label for total population/area (defaulting to ''City''), if needed to distinguish from ''Urban'', ''Rural'' or ''Metro'' (if urban, rural or metro figures are not present, the label is ''Total'' unless '''total_type''' is set). |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Transliteration(s) |- style="vertical-align:top;" | '''translit_lang1''' || optional || Will place the "entry" before the word "transliteration(s)". Can be used to specify a particular language like in [[Dêlêg]] or one may just enter "Other", like in [[Gaza City|Gaza]]'s article. |- style="vertical-align:top;" | '''translit_lang1_type'''<br />'''translit_lang1_type1'''<br />to<br />'''translit_lang1_type6''' || optional || |- style="vertical-align:top;" | '''translit_lang1_info'''<br />'''translit_lang1_info1'''<br />to<br />'''translit_lang1_info6''' || optional || |- style="vertical-align:top;" | '''translit_lang2''' || optional || Will place a second transliteration. See [[Dêlêg]] |- style="vertical-align:top;" | '''translit_lang2_type'''<br />'''translit_lang2_type1'''<br />to<br />'''translit_lang2_type6''' || optional || |- style="vertical-align:top;" | '''translit_lang2_info'''<br />'''translit_lang2_info1'''<br />to<br />'''translit_lang2_info6''' || optional || |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Images, nickname, motto=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Image |- style="vertical-align:top;" | '''image_skyline''' || optional || Primary image representing the settlement. Commonly a photo of the settlement’s skyline. |- style="vertical-align:top;" | '''imagesize''' || optional || Can be used to tweak the size of the image_skyline up or down. This can be helpful if an editor wants to make the infobox wider. If used, '''px''' must be specified; default size is 250px. |- style="vertical-align:top;" | '''image_alt''' || optional || [[Alt text]] for the image, used by visually impaired readers who cannot see the image. See [[WP:ALT]]. |- style="vertical-align:top;" | '''image_caption''' || optional || Will place a caption under the image_skyline (if present) |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Flag image |- style="vertical-align:top;" | '''image_flag''' || optional || Used for a flag. |- style="vertical-align:top;" | '''flag_size''' || optional || Can be used to tweak the size of the image_flag up or down from 100px as desired. If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''flag_alt''' || optional || Alt text for the flag. |- style="vertical-align:top;" | '''flag_border''' || optional || Set to 'no' to remove the border from the flag |- style="vertical-align:top;" | '''flag_link''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Seal image |- style="vertical-align:top;" | '''image_seal''' || optional || If the place has an official seal. |- style="vertical-align:top;" | '''seal_size''' || optional || If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''seal_alt''' || optional || Alt text for the seal. |- style="vertical-align:top;" | '''seal_link'''<br />'''seal_type''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Coat of arms image |- style="vertical-align:top;" | '''image_shield''' || optional || Can be used for a place with a coat of arms. |- style="vertical-align:top;" | '''shield_size''' || optional || If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''shield_alt''' || optional || Alt text for the shield. |- style="vertical-align:top;" | '''shield_link''' || optional || Can be used if a wiki article if known but is not automatically linked by the template. See [[Coquitlam, British Columbia]]'s infobox for an example. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Logo or emblem image |- style="vertical-align:top;" | '''image_blank_emblem''' || optional || Can be used if a place has an official logo, crest, emblem, etc. |- style="vertical-align:top;" | '''blank_emblem_type''' || optional || Caption beneath "image_blank_emblem" to specify what type of emblem it is. |- style="vertical-align:top;" | '''blank_emblem_size''' || optional || If used, '''px''' must be specified; default size is 100px. |- style="vertical-align:top;" | '''blank_emblem_alt''' || optional || Alt text for blank emblem. |- style="vertical-align:top;" | '''blank_emblem_link''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Nickname, motto |- style="vertical-align:top;" | '''etymology''' || optional || origin of name |- style="vertical-align:top;" | '''nickname''' || optional || well-known nickname |- style="vertical-align:top;" | '''nicknames''' || optional || if more than one well-known nickname, use this |- style="vertical-align:top;" | '''motto''' || optional || Will place the motto under the nicknames |- style="vertical-align:top;" | '''mottoes''' || optional || if more than one motto, use this |- style="vertical-align:top;" | '''anthem''' || optional || Will place the anthem (song) under the nicknames |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Maps, coordinates=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Map images |- style="vertical-align:top;" | '''image_map''' || optional || |- style="vertical-align:top;" | '''mapsize''' || optional || If used, '''px''' must be specified; default is 250px. |- style="vertical-align:top;" | '''map_alt''' || optional || Alt text for map. |- style="vertical-align:top;" | '''map_caption''' || optional || |- style="vertical-align:top;" | '''image_map1''' || optional || A secondary map image. The field '''image_map''' must be filled in first. Example see: [[Bloomsburg, Pennsylvania]]. |- style="vertical-align:top;" | '''mapsize1''' || optional || If used, '''px''' must be specified; default is 250px. |- style="vertical-align:top;" | '''map_alt1''' || optional || Alt text for secondary map. |- style="vertical-align:top;" | '''map_caption1''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Pushpin map(s), coordinates |- style="vertical-align:top;" | '''pushpin_map''' || optional || The name of a location map as per [[Template:Location map]] (e.g. ''Indonesia'' or ''Russia''). The coordinate fields (from {{para|coordinates}}) position a pushpin coordinate marker and label on the map '''automatically'''. Example: [[Padang, Indonesia]]. To show multiple pushpin maps, provide a list of maps separated by #, e.g., ''California#USA'' |- style="vertical-align:top;" | '''pushpin_mapsize''' || optional || Must be entered as only a number—'''do not use px'''. The default value is 250.<br/>''Equivalent to <code>width</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_map_alt''' || optional || Alt text for pushpin map; used by [[screen reader]]s, see [[WP:ALT]].<br/>''Equivalent to <code>alt</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_map_caption''' || optional || Fill out if a different caption from ''map_caption'' is desired.<br/>''Equivalent to <code>caption</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_map_caption_notsmall''' || optional || <!-- add documentation here --> |- style="vertical-align:top;" | '''pushpin_label''' || optional || The text of the label to display next to the identifying mark; a [[Wiki markup|wikilink]] can be used. If not specified, the label will be the text assigned to the ''name'' or ''official_name'' parameters (if {{para|pushpin_label_position|none}}, no label is displayed).<br/>''Equivalent to <code>label</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_label_position''' || optional || The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are {left, right, top, bottom, none}. If this field is not specified, the default value is ''right''.<br/>''Equivalent to <code>position</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_outside''' || optional || ''Equivalent to <code>outside</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_relief''' || optional || Set this to <code>y</code> or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available). <br/>''Equivalent to <code>relief</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_image''' || optional || Allows the use of an alternative map; the image must have the same edge coordinates as the location map template.<br/>''Equivalent to <code>AlternativeMap</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''pushpin_overlay''' || optional || Can be used to specify an image to be superimposed on the regular pushpin map.<br/>''Equivalent to <code>overlay_image</code> parameter in [[Template:Location map]].'' |- style="vertical-align:top;" | '''coordinates''' || optional || Latitude and longitude. Use {{tl|Coord}}. See the documentation for {{tl|Coord}} for more details on usage. |- style="vertical-align:top;" | '''coor_pinpoint''' || optional || If needed, to specify more exactly where (or what) coordinates are given (e.g. ''Town Hall'') or a specific place in a larger area (e.g. a city in a county). Example: In the article [[Masovian Voivodeship]], <code>coor_pinpoint=Warsaw</code> specifies [[Warsaw]]. |- style="vertical-align:top;" | '''coordinates_footnotes''' || optional || Reference(s) for coordinates, placed within <code><nowiki><ref> </ref></nowiki></code> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''grid_name'''<br />'''grid_position''' || optional || Name of a regional grid system and position on the regional grid |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Location, established, seat, subdivisions, government, leaders=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Location |- style="vertical-align:top;" | {{anchor|subdivision_type}}'''subdivision_type''' || optional || almost always <code><nowiki>Country</nowiki></code> |- style="vertical-align:top;" | '''subdivision_name''' || optional || Depends on the subdivision_type — use the name in text form, sample: <code>United States</code>. Per [[MOS:INFOBOXFLAG]], flag icons or flag templates may be used in this field |- style="vertical-align:top;" | '''subdivision_type1'''<br />to<br />'''subdivision_type6''' || optional || Can be State/Province, region, county. These labels are for subdivisions ''above'' the level of the settlement described in the article. For subdivisions ''below'' or ''within'' the place described in the article, use {{para|parts_type}}. |- style="vertical-align:top;" | '''subdivision_name1'''<br />to<br />'''subdivision_name6''' || optional || Use the name in text form, sample: <code>Florida</code> or <code><nowiki>[[Florida]]</nowiki></code>. Per [[MOS:INFOBOXFLAG]], flag icons or flag templates should '''not''' be used in these fields |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Established |- style="vertical-align:top;" | '''established_title''' || optional || Example: Founded |- style="vertical-align:top;" | '''established_date''' || optional || Requires established_title= |- style="vertical-align:top;" | '''established_title1''' || optional || Example: Incorporated (town) <br/>[Note that "established_title1" is distinct from "established_title"; you can think of "established_title" as behaving like "established_title0".] |- style="vertical-align:top;" | '''established_date1''' || optional || [See note for "established_title1".] Requires established_title1= |- style="vertical-align:top;" | '''established_title2''' || optional || Example: Incorporated (city) |- style="vertical-align:top;" | '''established_date2''' || optional || Requires established_title2= |- style="vertical-align:top;" | '''established_title3''' || optional || |- style="vertical-align:top;" | '''established_date3''' || optional || Requires established_title3= |- style="vertical-align:top;" | '''established_title4''' || optional || |- style="vertical-align:top;" | '''established_date4''' || optional || Requires established_title4= |- style="vertical-align:top;" | '''established_title5''' || optional || |- style="vertical-align:top;" | '''established_date5''' || optional || Requires established_title5= |- style="vertical-align:top;" | '''established_title6''' || optional || |- style="vertical-align:top;" | '''established_date6''' || optional || Requires established_title6= |- style="vertical-align:top;" | '''established_title7''' || optional || |- style="vertical-align:top;" | '''established_date7''' || optional || Requires established_title7= |- style="vertical-align:top;" | '''extinct_title''' || optional || For when a settlement ceases to exist |- style="vertical-align:top;" | '''extinct_date''' || optional || Requires extinct_title= |- style="vertical-align:top;" | '''founder''' || optional || Who the settlement was founded by |- style="vertical-align:top;" | '''named_for''' || optional || The source of the name of the settlement (a person, a place, et cetera) |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Seat of government |- style="vertical-align:top;" | '''seat_type''' || optional || The label for the seat of government (defaults to ''Seat''). |- style="vertical-align:top;" | '''seat''' || optional || The seat of government. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Smaller parts (e.g. boroughs of a city) |- style="vertical-align:top;" | '''parts_type''' || optional || The label for the smaller subdivisions (defaults to ''Boroughs''). |- style="vertical-align:top;" | '''parts_style''' || optional || Set to ''list'' to display as a collapsible list, ''coll'' as a collapsed list, or ''para'' to use paragraph style. Default is ''list'' for up to 5 items, otherwise ''coll''. |- style="vertical-align:top;" | '''parts''' || optional || Text or header of the list of smaller subdivisions. |- style="vertical-align:top;" | '''p1'''<br />'''p2'''<br />to<br />'''p50''' || optional || The smaller subdivisions to be listed. Example: [[Warsaw]] |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Government type, leaders |- style="vertical-align:top;" | '''government_footnotes''' || optional || Reference(s) for government, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''government_type''' || optional || Examples: [[Mayor–council government]], [[Council–manager government]], [[City commission government]], ... |- style="vertical-align:top;" | '''governing_body''' || optional || Name of the place's governing body |- style="vertical-align:top;" | '''leader_party''' || optional || Political party of the place's leader |- style="vertical-align:top;" | '''leader_title''' || optional || First title of the place's leader, e.g. Mayor |- style="vertical-align:top;" | '''leader_name''' || optional || Name of the place's leader |- style="vertical-align:top;" | '''leader_title1'''<br />to<br />'''leader_title4''' || optional || |- style="vertical-align:top;" | '''leader_name1'''<br />to<br />'''leader_name4''' || optional || For long lists use {{tl|Collapsible list}}. See [[Halifax Regional Municipality|Halifax]] for an example. |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Geographic information=== |- style="vertical-align:top;" | colspan=3 | These fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they should enter both values in their respective fields. |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Display settings |- style="vertical-align:top;" | '''total_type''' || optional || Specifies what "total" area and population figure refer to, e.g. ''Greater London''. This overrides other labels for total population/area. To make the total area and population display on the same line as the words "Area" and "Population", with no "Total" or similar label, set the value of this parameter to '''&amp;nbsp;'''. |- style="vertical-align:top;" | '''unit_pref''' || optional || To change the unit order to ''imperial (metric)'', enter '''imperial'''. The default display style is ''metric (imperial)''. However, the template will swap the order automatically if the '''subdivision_name''' equals some variation of the US or the UK.<br />For the middle east, a unit preference of [[dunam]] can be entered (only affects total area). <br /> All values must be entered in a '''raw format: no commas, spaces, or unit symbols'''. The template will format them automatically. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Area |- style="vertical-align:top;" | '''area_footnotes''' || optional || Reference(s) for area, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''dunam_link''' || optional || If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting <code>dunam_link</code> to another measure (e.g. <code>dunam_link=water</code>). Linking can also be turned off by setting the parameter to something else (e.g. <code>dunam_link=none</code> or <code>dunam_link=off</code>). |- style="vertical-align:top;" | '''area_total_km2''' || optional || Total area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_total_sq_mi is empty. |- style="vertical-align:top;" | '''area_total_ha''' || optional || Total area in hectares—symbol: ha. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display acres if area_total_acre is empty. |- style="vertical-align:top;" | '''area_total_sq_mi''' || optional || Total area in square miles—symbol: sq&nbsp;mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_total_km2 is empty. |- style="vertical-align:top;" | '''area_total_acre''' || optional || Total area in acres. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display hectares if area_total_ha is empty. |- style="vertical-align:top;" | '''area_total_dunam''' || optional || Total area in dunams, which is wiki-linked. Used in middle eastern places like Israel, Gaza, and the West Bank. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers or hectares and square miles or acreds if area_total_km2, area_total_ha, area_total_sq_mi, and area_total_acre are empty. Examples: [[Gaza City|Gaza]] and [[Ramallah]] |- style="vertical-align:top;" | '''area_land_km2''' || optional || Land area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_land_sq_mi is empty. |- style="vertical-align:top;" | '''area_land_sq_mi''' || optional || Land area in square miles—symbol: sq&nbsp;mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_land_km2 is empty. |- style="vertical-align:top;" | '''area_land_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_land_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_land_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_water_km2''' || optional || Water area in square kilometers—symbol: km<sup>2</sup>. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square miles if area_water_sq_mi is empty. |- style="vertical-align:top;" | '''area_water_sq_mi''' || optional || Water area in square miles—symbol: sq&nbsp;mi. Value must be entered in '''raw format''', no commas or spaces. Auto-converted to display square kilometers if area_water_km2 is empty. |- style="vertical-align:top;" | '''area_water_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_water_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_water_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_water_percent''' || optional || percent of water without the "%" |- style="vertical-align:top;" | '''area_urban_km2''' || optional || |- style="vertical-align:top;" | '''area_urban_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_urban_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_urban_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_urban_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" |- style="vertical-align:top;" | '''area_rural_km2''' || optional || |- style="vertical-align:top;" | '''area_rural_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_rural_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_rural_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_rural_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_metro_km2''' || optional || |- style="vertical-align:top;" | '''area_metro_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_metro_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_metro_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_metro_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_rank''' || optional || The settlement's area, as ranked within its parent sub-division |- style="vertical-align:top;" | '''area_blank1_title''' || optional || Example see London |- style="vertical-align:top;" | '''area_blank1_km2''' || optional || |- style="vertical-align:top;" | '''area_blank1_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_blank1_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_blank1_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_blank1_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_blank2_title''' || optional || |- style="vertical-align:top;" | '''area_blank2_km2''' || optional || |- style="vertical-align:top;" | '''area_blank2_sq_mi''' || optional || |- style="vertical-align:top;" | '''area_blank2_ha''' || optional || similar to <code>area_total_ha</code> |- style="vertical-align:top;" | '''area_blank2_dunam''' || optional || similar to <code>area_total_dunam</code> |- style="vertical-align:top;" | '''area_blank2_acre''' || optional || similar to <code>area_total_acre</code> |- style="vertical-align:top;" | '''area_note''' || optional || A place for additional information such as the name of the source. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Dimensions |- style="vertical-align:top;" | '''dimensions_footnotes''' || optional || Reference(s) for dimensions, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''length_km''' || optional || Raw number entered in kilometers. Will automatically convert to display length in miles if length_mi is empty. |- style="vertical-align:top;" | '''length_mi''' || optional || Raw number entered in miles. Will automatically convert to display length in kilometers if length_km is empty. |- style="vertical-align:top;" | '''width_km''' || optional || Raw number entered in kilometers. Will automatically convert to display width in miles if length_mi is empty. |- style="vertical-align:top;" | '''width_mi''' || optional || Raw number entered in miles. Will automatically convert to display width in kilometers if length_km is empty. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Elevation |- style="vertical-align:top;" | '''elevation_footnotes''' || optional || Reference(s) for elevation, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''elevation_m''' || optional || Raw number entered in meters. Will automatically convert to display elevation in feet if elevation_ft is empty. However, if a range in elevation (i.e. 5–50 m ) is desired, use the "max" and "min" fields below |- style="vertical-align:top;" | '''elevation_ft''' || optional || Raw number, entered in feet. Will automatically convert to display the average elevation in meters if '''elevation_m''' field is empty. However, if a range in elevation (e.g. 50–500&nbsp;ft ) is desired, use the "max" and "min" fields below |- style="vertical-align:top;" | '''elevation_max_footnotes'''<br />'''elevation_min_footnotes''' || optional || Same as above, but for the "max" and "min" elevations. See [[City of Leeds]]. |- style="vertical-align:top;" | '''elevation_max_m'''<br />'''elevation_max_ft'''<br />'''elevation_max_rank'''<br />'''elevation_min_m'''<br />'''elevation_min_ft'''<br />'''elevation_min_rank''' || optional || Used to give highest & lowest elevations and rank, instead of just a single value. Example: [[Halifax Regional Municipality]]. |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Population, demographics=== |- style="vertical-align:top;" | colspan=3 | The density fields have '''dual automatic unit conversion''' meaning that if only metric values are entered, the imperial values will be automatically converted and vice versa. If an editor wishes to over-ride the automatic conversion, e.g. if the source gives both metric and imperial or if a range of values is needed, they can enter both values in their respective fields. '''To calculate density with respect to the total area automatically, type ''auto'' in place of any density value.''' |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Population |- style="vertical-align:top;" | '''population_total''' || optional || Actual population (see below for estimates) preferably consisting of digits only (without any commas) |- style="vertical-align:top;" | '''population_as_of''' || optional || The year for the population total (usually a census year) |- style="vertical-align:top;" | '''population_footnotes''' || optional || Reference(s) for population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_km2''' || optional || |- style="vertical-align:top;" | '''population_density_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_est''' || optional || Population estimate. |- style="vertical-align:top;" | '''pop_est_as_of''' || optional || The year or month & year of the population estimate |- style="vertical-align:top;" | '''pop_est_footnotes''' || optional || Reference(s) for population estimate, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_urban''' || optional || |- style="vertical-align:top;" | '''population_urban_footnotes''' || optional || Reference(s) for urban population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_urban_km2''' || optional || |- style="vertical-align:top;" | '''population_density_urban_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_rural''' || optional || |- style="vertical-align:top;" | '''population_rural_footnotes''' || optional || Reference(s) for rural population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_rural_km2''' || optional || |- style="vertical-align:top;" | '''population_density_rural_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_metro''' || optional || |- style="vertical-align:top;" | '''population_metro_footnotes''' || optional || Reference(s) for metro population, placed within <nowiki><ref> </ref></nowiki> tags |- style="vertical-align:top;" | '''population_density_metro_km2''' || optional || |- style="vertical-align:top;" | '''population_density_metro_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_rank''' || optional || The settlement's population, as ranked within its parent sub-division |- style="vertical-align:top;" | '''population_density_rank''' || optional || The settlement's population density, as ranked within its parent sub-division |- style="vertical-align:top;" | '''population_blank1_title''' || optional || Can be used for estimates. Example: [[Windsor, Ontario]] |- style="vertical-align:top;" | '''population_blank1''' || optional || The population value for blank1_title |- style="vertical-align:top;" | '''population_density_blank1_km2''' || optional || |- style="vertical-align:top;" | '''population_density_blank1_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_blank2_title''' || optional || |- style="vertical-align:top;" | '''population_blank2''' || optional || |- style="vertical-align:top;" | '''population_density_blank2_km2''' || optional || |- style="vertical-align:top;" | '''population_density_blank2_sq_mi''' || optional || |- style="vertical-align:top;" | '''population_demonym''' || optional || A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in [[Liverpool]] is known as a [[Liverpudlian]]. |- style="vertical-align:top;" | '''population_demonyms''' || optional || If more than one demonym, use this |- style="vertical-align:top;" | '''population_note''' || optional || A place for additional information such as the name of the source. See [[Windsor, Ontario]] for example. |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Demographics (section 1) |- style="vertical-align:top;" | '''demographics_type1''' || optional || Section Header. For example: Ethnicity |- style="vertical-align:top;" | '''demographics1_footnotes''' || optional || Reference(s) for demographics section 1, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''demographics1_title1'''<br />to<br />'''demographics1_title7''' || optional || Titles related to demographics_type1. For example: White, Black, Hispanic... |- style="vertical-align:top;" | '''demographics1_info1'''<br />to<br />'''demographics1_info7''' || optional || Information related to the "titles". For example: 50%, 25%, 10%... |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Demographics (section 2) |- style="vertical-align:top;" | '''demographics_type2''' || optional || A second section header. For example: Languages |- style="vertical-align:top;" | '''demographics2_footnotes''' || optional || Reference(s) for demographics section 2, placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{tl|Cite web}} |- style="vertical-align:top;" | '''demographics2_title1'''<br />to<br />'''demographics2_title10''' || optional || Titles related to '''demographics_type2'''. For example: English, French, Arabic... |- style="vertical-align:top;" | '''demographics2_info1'''<br />to<br />'''demographics2_info10''' || optional || Information related to the "titles" for type2. For example: 50%, 25%, 10%... |- style="vertical-align:top;" | colspan=3 style="background: orange; text-align: center;" | ===Other information=== |- style="background: whitesmoke;" ! Parameter name !! Usage !! Description |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Time zone(s) |- style="vertical-align:top;" | '''timezone1''' || optional || |- style="vertical-align:top;" | '''utc_offset1''' || optional || Plain text, e.g. "+05:00" or "-08:00". Auto-linked, so do not include references or additional text. |- style="vertical-align:top;" | '''timezone1_DST''' || optional || |- style="vertical-align:top;" | '''utc_offset1_DST''' || optional || |- style="vertical-align:top;" | '''timezone2''' || optional || A second timezone field for larger areas such as a Province. |- style="vertical-align:top;" | '''utc_offset2''' || optional || |- style="vertical-align:top;" | '''timezone2_DST''' || optional || |- style="vertical-align:top;" | '''utc_offset2_DST''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Postal code(s) & area code |- style="vertical-align:top;" | '''postal_code_type''' || optional || |- style="vertical-align:top;" | '''postal_code''' || optional || |- style="vertical-align:top;" | '''postal2_code_type''' || optional || |- style="vertical-align:top;" | '''postal2_code''' || optional || |- style="vertical-align:top;" | '''area_code_type''' || optional || If left blank/not used template will default to "[[Telephone numbering plan|Area code(s)]]" |- style="vertical-align:top;" | '''area_code''' || optional || Refers to the telephone dialing code for the settlement, ''not'' a geographic area code. |- style="vertical-align:top;" | '''area_codes''' || optional || If more than one area code, use this |- style="vertical-align:top;" | '''geocode''' || optional || See [[Geocode]] |- style="vertical-align:top;" | '''iso_code''' || optional || See [[ISO 3166]] |- style="vertical-align:top;" | '''registration_plate_type''' || optional || If left blank/not used template will default to "[[Vehicle registration plate|Vehicle registration]]" |- style="vertical-align:top;" | '''registration_plate''' || optional || See [[Vehicle registration plate]] |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Blank fields (section 1) |- style="vertical-align:top;" | '''blank_name_sec1''' || optional || Fields used to display other information. The name is displayed in bold on the left side of the infobox. |- style="vertical-align:top;" | '''blank_info_sec1''' || optional || The information associated with the ''blank_name'' heading. The info is displayed on right side of infobox, in the same row as the name. For an example, see: [[Warsaw]] |- style="vertical-align:top;" | '''blank1_name_sec1'''<br />to<br />'''blank7_name_sec1''' || optional || Up to 7 additional fields (8 total) can be displayed in this section |- style="vertical-align:top;" | '''blank1_info_sec1'''<br />to<br />'''blank7_info_sec1''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Blank fields (section 2) |- style="vertical-align:top;" | '''blank_name_sec2''' || optional || For a second section of blank fields |- style="vertical-align:top;" | '''blank_info_sec2''' || optional || Example: [[Beijing]] |- style="vertical-align:top;" | '''blank1_name_sec2'''<br />to<br />'''blank7_name_sec2''' || optional || Up to 7 additional fields (8 total) can be displayed in this section |- style="vertical-align:top;" | '''blank1_info_sec2'''<br />to<br />'''blank7_info_sec2''' || optional || |- style="vertical-align:top;" ! colspan=3 style="background: #DDDDDD;" | Website, footnotes |- style="vertical-align:top;" | '''website''' || optional || External link to official website, Use {{Tl|URL}}, thus: <nowiki>{{URL|example.com}}</nowiki> |- style="vertical-align:top;" | '''module''' || optional || To embed infoboxes at the bottom of the infobox |- style="vertical-align:top;" | '''footnotes''' || optional || Text to be displayed at the bottom of the infobox |- style="vertical-align:top;" | '''short_description''' || optional || [[WP:SHORTDESC|specify custom short description]]; if not specified, one will be automatically generated, e.g. "Place in Israel". |} <!-- End of parameter name/description table --> ==Examples== ;Example 1: <!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. --> {{Infobox settlement | name = Chicago | settlement_type = [[City (Illinois)|City]] | image_skyline = Chicago montage.jpg | imagesize = 275px <!--default is 250px--> | image_caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]] | image_flag = Flag of Chicago, Illinois.svg | image_seal = Seal of Chicago, Illinois.svg | etymology = {{lang-mia|shikaakwa}} ("wild onion" or "wild garlic") | nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]] | motto = {{lang-la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will | image_map = US-IL-Chicago.png | map_caption = Location in the [[Chicago metropolitan area]] and Illinois | pushpin_map = USA | pushpin_map_caption = Location in the United States | coordinates = {{coord|41|50|15|N|87|40|55|W}} | coordinates_footnotes = <ref name="USCB Gazetteer 2010"/> | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = [[Illinois]] | subdivision_type2 = [[List of counties in Illinois|Counties]] | subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]] | established_title = Settled | established_date = 1770s | established_title2 = [[Municipal corporation|Incorporated]] | established_date2 = March 4, 1837 | founder = | named_for = {{lang-mia|shikaakwa}}<br /> ("Wild onion") | government_type = [[Mayor–council government|Mayor–council]] | leader_title = [[Mayor of Chicago|Mayor]] | leader_name = [[Rahm Emanuel]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[City council|Council]] | leader_name1 = [[Chicago City Council]] | unit_pref = Imperial | area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref> | area_total_sq_mi = 234.114 | area_land_sq_mi = 227.635 | area_water_sq_mi = 6.479 | area_water_percent = 3 | area_urban_sq_mi = 2123 | area_metro_sq_mi = 10874 | elevation_footnotes = <ref name="GNIS"/> | elevation_ft = 594 | elevation_m = 181 | population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref> | population_as_of = [[2010 United States Census|2010]] | population_total = 2695598 | pop_est_footnotes = | pop_est_as_of = 2011 | population_est = 2707120 | population_rank = [[List of United States cities by population|3rd US]] | population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi --> | population_urban = 8711000 | population_density_urban_sq_mi = auto | population_metro = 9461105 | population_density_metro_sq_mi = auto | population_demonym = Chicagoan | timezone = [[Central Standard Time|CST]] | utc_offset = −06:00 | timezone_DST = [[Central Daylight Time|CDT]] | utc_offset_DST = −05:00 | area_code_type = [[North American Numbering Plan|Area codes]] | area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]] | blank_name = [[Federal Information Processing Standards|FIPS]] code | blank_info = {{FIPS|17|14000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|423587}}, {{GNIS 4|428803}} | website = {{URL|www.cityofchicago.org}} | footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref> }} <syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;"> <!-- NOTE: This differs from the actual Chicago infobox in order to provide examples. --> {{Infobox settlement | name = Chicago | settlement_type = [[City (Illinois)|City]] | image_skyline = Chicago montage.jpg | imagesize = 275px <!--default is 250px--> | image_caption = Clockwise from top: [[Downtown Chicago]], the [[Chicago Theatre]], the [[Chicago 'L']], [[Navy Pier]], [[Millennium Park]], the [[Field Museum]], and the [[Willis Tower|Willis (formerly Sears) Tower]] | image_flag = Flag of Chicago, Illinois.svg | image_seal = Seal of Chicago, Illinois.svg | etymology = {{lang-mia|shikaakwa}} ("wild onion" or "wild garlic") | nickname = [[Origin of Chicago's "Windy City" nickname|The Windy City]], The Second City, Chi-Town, Chi-City, Hog Butcher for the World, City of the Big Shoulders, The City That Works, and others found at [[List of nicknames for Chicago]] | motto = {{lang-la|Urbs in Horto}} (City in a Garden), Make Big Plans (Make No Small Plans), I Will | image_map = US-IL-Chicago.png | map_caption = Location in the [[Chicago metropolitan area]] and Illinois | pushpin_map = USA | pushpin_map_caption = Location in the United States | coordinates = {{coord|41|50|15|N|87|40|55|W}} | coordinates_footnotes = <ref name="USCB Gazetteer 2010"/> | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = [[Illinois]] | subdivision_type2 = [[List of counties in Illinois|Counties]] | subdivision_name2 = [[Cook County, Illinois|Cook]], [[DuPage County, Illinois|DuPage]] | established_title = Settled | established_date = 1770s | established_title2 = [[Municipal corporation|Incorporated]] | established_date2 = March 4, 1837 | founder = | named_for = {{lang-mia|shikaakwa}}<br /> ("Wild onion") | government_type = [[Mayor–council government|Mayor–council]] | leader_title = [[Mayor of Chicago|Mayor]] | leader_name = [[Rahm Emanuel]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[City council|Council]] | leader_name1 = [[Chicago City Council]] | unit_pref = Imperial | area_footnotes = <ref name="USCB Gazetteer 2010">{{cite web | url = https://www.census.gov/geo/www/gazetteer/files/Gaz_places_national.txt | title = 2010 United States Census Gazetteer for Places: January 1, 2010 | format = text | work = 2010 United States Census | publisher = [[United States Census Bureau]] | date = April 2010 | access-date = August 1, 2012}}</ref> | area_total_sq_mi = 234.114 | area_land_sq_mi = 227.635 | area_water_sq_mi = 6.479 | area_water_percent = 3 | area_urban_sq_mi = 2123 | area_metro_sq_mi = 10874 | elevation_footnotes = <ref name="GNIS"/> | elevation_ft = 594 | elevation_m = 181 | population_footnotes = <ref name="USCB PopEstCities 2011">{{cite web | url = https://www.census.gov/popest/data/cities/totals/2011/tables/SUB-EST2011-01.csv | title = Annual Estimates of the Resident Population for Incorporated Places Over 50,000, Ranked by July 1, 2011 Population | format = [[comma-separated values|CSV]] | work = 2011 Population Estimates | publisher = [[United States Census Bureau]], Population Division | date = June 2012 | access-date = August 1, 2012}}</ref><ref name="USCB Metro 2010">{{cite web | url=https://www.census.gov/prod/cen2010/briefs/c2010br-01.pdf | title = Population Change for the Ten Most Populous and Fastest Growing Metropolitan Statiscal Areas: 2000 to 2010 | date = March 2011 | publisher = [[U.S. Census Bureau]] | page = 6 |access-date = April 12, 2011}}</ref> | population_as_of = [[2010 United States Census|2010]] | population_total = 2695598 | pop_est_footnotes = | pop_est_as_of = 2011 | population_est = 2707120 | population_rank = [[List of United States cities by population|3rd US]] | population_density_sq_mi = 11,892.4<!-- 2011 population_est / area_land_sq_mi --> | population_urban = 8711000 | population_density_urban_sq_mi = auto | population_metro = 9461105 | population_density_metro_sq_mi = auto | population_demonym = Chicagoan | timezone = [[Central Standard Time|CST]] | utc_offset = −06:00 | timezone_DST = [[Central Daylight Time|CDT]] | utc_offset_DST = −05:00 | area_code_type = [[North American Numbering Plan|Area codes]] | area_codes = [[Area code 312|312]], [[Area code 773|773]], [[Area code 872|872]] | blank_name = [[Federal Information Processing Standards|FIPS]] code | blank_info = {{FIPS|17|14000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|423587}}, {{GNIS 4|428803}} | website = {{URL|www.cityofchicago.org}} | footnotes = <ref name="GNIS">{{Cite gnis|428803|City of Chicago|April 12, 2011}}</ref> }} </syntaxhighlight> '''References''' {{reflist}} {{clear}} ---- ;Example 2: {{Infobox settlement | name = Detroit | settlement_type = [[City (Michigan)|City]] | image_skyline = Detroit Montage.jpg | imagesize = 290px | image_caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]]. | image_flag = Flag of Detroit, Michigan.svg | image_seal = Seal of Detroit, Michigan.svg | etymology = {{lang-fr|détroit}} ([[strait]]) | nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313 | motto = ''Speramus Meliora; Resurget Cineribus''<br /><small>([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)</small> | image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg | mapsize = 250x200px | map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]] | pushpin_map = USA | pushpin_map_caption = Location within the [[contiguous United States]] | coordinates = {{coord|42|19|53|N|83|2|45|W}} | coordinates_footnotes = | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = [[Michigan]] | subdivision_type2 = [[List of counties in Michigan|County]] | subdivision_name2 = [[Wayne County, Michigan|Wayne]] | established_title = Founded | established_date = 1701 | established_title2 = Incorporated | established_date2 = 1806 | government_footnotes = <!-- for references: use<ref> tags --> | government_type = [[Mayor–council government|Mayor–council]] | leader_title = [[List of mayors of Detroit|Mayor]] | leader_name = [[Mike Duggan]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[Detroit City Council|City Council]] | leader_name1 = {{collapsible list|bullets=yes | title = Members | 1 = [[Charles Pugh]] – Council President | 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem | 3 = [[JoAnn Watson]] | 4 = [[Kenneth Cockrel, Jr.]] | 5 = [[Saunteel Jenkins]] | 6 = [[Andre Spivey]] | 7 = [[James Tate (Detroit politician)|James Tate]] | 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]] | 9 = [[Kwame Kenyatta]] }} | unit_pref = Imperial | area_footnotes = | area_total_sq_mi = 142.87 | area_total_km2 = 370.03 | area_land_sq_mi = 138.75 | area_land_km2 = 359.36 | area_water_sq_mi = 4.12 | area_water_km2 = 10.67 | area_urban_sq_mi = 1295 | area_metro_sq_mi = 3913 | elevation_footnotes = | elevation_ft = 600 | population_footnotes = | population_as_of = 2011 | population_total = 706585 | population_rank = [[List of United States cities by population|18th in U.S.]] | population_urban = 3863924 | population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]]) | population_blank1_title = [[Combined statistical area|CSA]] | population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]]) | population_density_sq_mi= {{#expr:713777/138.8 round 0}} | population_demonym = Detroiter | population_note = | timezone = [[Eastern Time Zone (North America)|EST]] | utc_offset = −5 | timezone_DST = [[Eastern Daylight Time|EDT]] | utc_offset_DST = −4 | postal_code_type = | postal_code = | area_code = [[Area code 313|313]] | blank_name = [[Federal Information Processing Standards|FIPS code]] | blank_info = {{FIPS|26|22000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|1617959}}, {{GNIS 4|1626181}} | website = [http://www.detroitmi.gov/ DetroitMI.gov] | footnotes = }} <syntaxhighlight lang="wikitext" style="overflow:auto; white-space: pre-wrap;"> {{Infobox settlement | name = Detroit | settlement_type = [[City (Michigan)|City]] | official_name = City of Detroit | image_skyline = Detroit Montage.jpg | imagesize = 290px | image_caption = Images from top to bottom, left to right: [[Downtown Detroit]] skyline, [[Spirit of Detroit]], [[Greektown Historic District|Greektown]], [[Ambassador Bridge]], [[Michigan Soldiers' and Sailors' Monument]], [[Fox Theatre (Detroit)|Fox Theatre]], and [[Comerica Park]]. | image_flag = Flag of Detroit, Michigan.svg | image_seal = Seal of Detroit, Michigan.svg | etymology = {{lang-fr|détroit}} ([[strait]]) | nickname = The Motor City, Motown, Renaissance City, The D, Hockeytown, The Automotive Capital of the World, Rock City, The 313 | motto = ''Speramus Meliora; Resurget Cineribus''<br /><small>([[Latin]]: We Hope For Better Things; It Shall Rise From the Ashes)</small> | image_map = Wayne County Michigan Incorporated and Unincorporated areas Detroit highlighted.svg | mapsize = 250x200px | map_caption = Location within [[Wayne County, Michigan|Wayne County]] and the state of [[Michigan]] | pushpin_map = USA | pushpin_map_caption = Location within the [[contiguous United States]] | coordinates = {{coord|42|19|53|N|83|2|45|W}} | coordinates_footnotes = | subdivision_type = Country | subdivision_name = United States | subdivision_type1 = State | subdivision_name1 = Michigan | subdivision_type2 = [[List of counties in Michigan|County]] | subdivision_name2 = [[Wayne County, Michigan|Wayne]] | established_title = Founded | established_date = 1701 | established_title2 = Incorporated | established_date2 = 1806 | government_footnotes = <!-- for references: use<ref> tags --> | government_type = [[Mayor-council government|Mayor-Council]] | leader_title = [[List of mayors of Detroit|Mayor]] | leader_name = [[Mike Duggan]] | leader_party = [[Democratic Party (United States)|D]] | leader_title1 = [[Detroit City Council|City Council]] | leader_name1 = {{collapsible list|bullets=yes | title = Members | 1 = [[Charles Pugh]] – Council President | 2 = [[Gary Brown (Detroit politician)|Gary Brown]] – Council President Pro-Tem | 3 = [[JoAnn Watson]] | 4 = [[Kenneth Cockrel, Jr.]] | 5 = [[Saunteel Jenkins]] | 6 = [[Andre Spivey]] | 7 = [[James Tate (Detroit politician)|James Tate]] | 8 = [[Brenda Jones (Detroit politician)|Brenda Jones]] | 9 = [[Kwame Kenyatta]] }} | unit_pref = Imperial | area_footnotes = | area_total_sq_mi = 142.87 | area_total_km2 = 370.03 | area_land_sq_mi = 138.75 | area_land_km2 = 359.36 | area_water_sq_mi = 4.12 | area_water_km2 = 10.67 | area_urban_sq_mi = 1295 | area_metro_sq_mi = 3913 | elevation_footnotes = | elevation_ft = 600 | population_footnotes = | population_as_of = 2011 | population_total = 706585 | population_rank = [[List of United States cities by population|18th in U.S.]] | population_urban = 3863924 | population_metro = 4285832 (US: [[List of United States metropolitan statistical areas|13th]]) | population_blank1_title = [[Combined statistical area|CSA]] | population_blank1 = 5207434 (US: [[List of United States combined statistical areas|11th]]) | population_density_sq_mi= {{#expr:713777/138.8 round 0}} | population_demonym = Detroiter | population_note = | timezone = [[Eastern Time Zone (North America)|EST]] | utc_offset = −5 | timezone_DST = [[Eastern Daylight Time|EDT]] | utc_offset_DST = −4 | postal_code_type = | postal_code = | area_code = [[Area code 313|313]] | blank_name = [[Federal Information Processing Standards|FIPS code]] | blank_info = {{FIPS|26|22000}} | blank1_name = [[Geographic Names Information System|GNIS]] feature ID | blank1_info = {{GNIS 4|1617959}}, {{GNIS 4|1626181}} | website = [http://www.detroitmi.gov/ DetroitMI.gov] | footnotes = }} </syntaxhighlight> {{clear}} ==Supporting templates== The following is a list of sub-templates used by Infobox settlement. See the [{{fullurl:Special:PrefixIndex|prefix=Infobox+settlement%2F&namespace=10&hideredirects=1}} current list of all sub-templates] for documentation, sandboxes, testcases, etc. # {{tl|Infobox settlement/areadisp}} # {{tl|Infobox settlement/densdisp}} # {{tl|Infobox settlement/dunam}} # {{tl|Infobox settlement/dunam/mag}} # {{tl|Infobox settlement/impus}} # {{tl|Infobox settlement/impus/mag}} # {{tl|Infobox settlement/lengthdisp}} # {{tl|Infobox settlement/link}} # {{tl|Infobox settlement/metric}} # {{tl|Infobox settlement/metric/mag}} # {{tl|Infobox settlement/pref}} ==Microformat== {{UF-hcard-geo}} == TemplateData == {{TemplateData header}} {{collapse top|title=TemplateData}} <templatedata> { "description": "Infobox for human settlements (cities, towns, villages, communities) as well as other administrative districts, counties, provinces, etc.", "format": "{{_\n| __________________ = _\n}}\n", "params": { "name": { "label": "Common name", "description": "This is the usual name in English. If it's not specified, the infobox will use the 'official_name' as a title unless this too is missing, in which case the page name will be used.", "type": "string", "suggested": true }, "official_name": { "label": "Official name", "description": "The official name in English, if different from 'name'.", "type": "string", "suggested": true }, "native_name": { "label": "Native name", "description": "This will display under the name/official name.", "type": "string", "example": "Distrito Federal de México" }, "native_name_lang": { "label": "Native name language", "description": "Use ISO 639-1 code, e.g. 'fr' for French. If there is more than one native name in different languages, enter those names using {{lang}} instead.", "type": "string", "example": "zh" }, "other_name": { "label": "Other name", "description": "For places with a former or more common name like Bombay or Saigon.", "type": "string" }, "settlement_type": { "label": "Type of settlement", "description": "Any type can be entered, such as 'City', 'Town', 'Village', 'Hamlet', 'Municipality', 'Reservation', etc. If set, will be displayed under the names, provided either 'name' or 'official_name' is filled in. Might also be used as a label for total population/area (defaulting to 'City'), if needed to distinguish from 'Urban', 'Rural' or 'Metro' (if urban, rural or metro figures are not present, the label is 'Total' unless 'total_type' is set).", "type": "string", "aliases": [ "type" ] }, "translit_lang1": { "label": "Transliteration from language 1", "description": "Will place the entry before the word 'transliteration(s)'. Can be used to specify a particular language, like in Dêlêg, or one may just enter 'Other', like in Gaza's article.", "type": "string" }, "translit_lang1_type": { "label": "Transliteration type for language 1", "type": "line", "example": "[[Hanyu pinyin]]", "description": "The type of transliteration used for the first language." }, "translit_lang1_info": { "label": "Transliteration language 1 info", "description": "Parameters 'translit_lang2_info1' ... 'translit_lang2_info6' are also available, but not documented here.", "type": "string" }, "translit_lang2": { "label": "Transliteration language 2", "description": "Will place a second transliteration. See Dêlêg.", "type": "string" }, "image_skyline": { "label": "Image", "description": "Primary image representing the settlement. Commonly a photo of the settlement’s skyline.", "type": "wiki-file-name" }, "imagesize": { "label": "Image size", "description": "Can be used to tweak the size of 'image_skyline' up or down. This can be helpful if an editor wants to make the infobox wider. If used, 'px' must be specified; default size is 250px.", "type": "string" }, "image_alt": { "label": "Image alt text", "description": "Alt (hover) text for the image, used by visually impaired readers who cannot see the image.", "type": "string" }, "image_caption": { "label": "Image caption", "description": "Will place a caption under 'image_skyline' (if present).", "type": "content" }, "image_flag": { "label": "Flag image", "description": "Used for a flag.", "type": "wiki-file-name" }, "flag_size": { "label": "Flag size", "description": "Can be used to tweak the size of 'image_flag' up or down from 100px as desired. If used, 'px' must be specified; default size is 100px.", "type": "string" }, "flag_alt": { "label": "Flag alt text", "description": "Alt text for the flag.", "type": "string" }, "flag_border": { "label": "Flag border?", "description": "Set to 'no' to remove the border from the flag.", "type": "boolean", "example": "no" }, "flag_link": { "label": "Flag link", "type": "string", "description": "Link to the flag." }, "image_seal": { "label": "Official seal image", "description": "An image of an official seal, if the place has one.", "type": "wiki-file-name" }, "seal_size": { "label": "Seal size", "description": "If used, 'px' must be specified; default size is 100px.", "type": "string" }, "seal_alt": { "label": "Seal alt text", "description": "Alt (hover) text for the seal.", "type": "string" }, "seal_link": { "label": "Seal link", "type": "string", "description": "Link to the seal." }, "image_shield": { "label": "Coat of arms/shield image", "description": "Can be used for a place with a coat of arms.", "type": "wiki-file-name" }, "shield_size": { "label": "Shield size", "description": "If used, 'px' must be specified; default size is 100px.", "type": "string", "example": "200px" }, "shield_alt": { "label": "Shield alt text", "description": "Alternate text for the shield.", "type": "string" }, "shield_link": { "label": "Shield link", "description": "Can be used if a wiki article if known but is not automatically linked by the template. See Coquitlam, British Columbia's infobox for an example.", "type": "string" }, "image_blank_emblem": { "label": "Blank emblem image", "description": "Can be used if a place has an official logo, crest, emblem, etc.", "type": "wiki-file-name" }, "blank_emblem_type": { "label": "Blank emblem type", "description": "Caption beneath 'image_blank_emblem' to specify what type of emblem it is.", "type": "string", "example": "Logo" }, "blank_emblem_size": { "label": "Blank emblem size", "description": "If used, 'px' must be specified; default size is 100px.", "type": "string", "example": "200px" }, "blank_emblem_alt": { "label": "Blank emblem alt text", "description": "Alt text for blank emblem.", "type": "string" }, "blank_emblem_link": { "label": "Blank emblem link", "type": "string", "description": "A link to the emblem of custom type." }, "nickname": { "label": "Nickname", "description": "Well-known nickname(s).", "type": "string", "example": "Sin City" }, "motto": { "label": "Motto", "description": "Will place the motto under the nicknames.", "type": "string" }, "anthem": { "label": "Anthem", "description": "Will place the anthem (song) under the nicknames.", "type": "string", "example": "[[Hatikvah]]" }, "image_map": { "label": "Map image", "description": "A map of the region, or a map with the region highlighted within a parent region.", "type": "wiki-file-name" }, "mapsize": { "label": "Map size", "description": "If used, 'px' must be specified; default is 250px.", "type": "string" }, "map_alt": { "label": "Map alt text", "description": "Alternate (hover) text for the map.", "type": "string" }, "map_caption": { "label": "Map caption", "type": "content", "description": "Caption for the map displayed." }, "image_map1": { "label": "Map 2 image", "description": "A secondary map image. The field 'image_map' must be filled in first. For an example, see [[Bloomsburg, Pennsylvania]].", "example": "File:Columbia County Pennsylvania Incorporated and Unincorporated areas Bloomsburg Highlighted.svg", "type": "wiki-file-name" }, "mapsize1": { "label": "Map 2 size", "description": "If used, 'px' must be specified; default is 250px.", "type": "string", "example": "300px" }, "map_alt1": { "label": "Map 2 alt text", "description": "Alt (hover) text for the second map.", "type": "string" }, "map_caption1": { "label": "Map 2 caption", "type": "content", "description": "Caption of the second map." }, "pushpin_map": { "label": "Pushpin map", "description": "The name of a location map (e.g. 'Indonesia' or 'Russia'). The coordinates information (from the coordinates parameter) positions a pushpin coordinate marker and label on the map automatically. For an example, see Padang, Indonesia.", "type": "string", "example": "Indonesia" }, "pushpin_mapsize": { "label": "Pushpin map size", "description": "Must be entered as only a number—do not use 'px'. The default value is 250.", "type": "number", "example": "200" }, "pushpin_map_alt": { "label": "Pushpin map alt text", "description": "Alt (hover) text for the pushpin map.", "type": "string" }, "pushpin_map_caption": { "label": "Pushpin map caption", "description": "Fill out if a different caption from 'map_caption' is desired.", "type": "string", "example": "Map showing Bloomsburg in Pennsylvania" }, "pushpin_label": { "label": "Pushpin label", "type": "line", "example": "Bloomsburg", "description": "Label of the pushpin." }, "pushpin_label_position": { "label": "Pushpin label position", "description": "The position of the label on the pushpin map relative to the pushpin coordinate marker. Valid options are 'left', 'right', 'top', 'bottom', and 'none'. If this field is not specified, the default value is 'right'.", "type": "string", "example": "left", "default": "right" }, "pushpin_outside": { "label": "Pushpin outside?", "type": "line" }, "pushpin_relief": { "label": "Pushpin relief", "description": "Set this to 'y' or any non-blank value to use an alternative relief map provided by the selected location map (if a relief map is available).", "type": "string", "example": "y" }, "pushpin_image": { "label": "Pushpin image", "type": "wiki-file-name", "description": "Image to use for the pushpin." }, "pushpin_overlay": { "label": "Pushpin overlay", "description": "Can be used to specify an image to be superimposed on the regular pushpin map.", "type": "wiki-file-name" }, "coordinates": { "label": "Coordinates", "description": "Latitude and longitude. Use {{Coord}}. See the documentation for {{Coord}} for more details on usage.", "type": "wiki-template-name", "example": "{{coord|41|50|15|N|87|40|55|W}}" }, "coor_pinpoint": { "label": "Coordinate pinpoint", "description": "If needed, to specify more exactly where (or what) coordinates are given (e.g. 'Town Hall') or a specific place in a larger area (e.g. a city in a county). Example: Masovian Voivodeship.", "type": "string" }, "coordinates_footnotes": { "label": "Coordinates footnotes", "description": "Reference(s) for coordinates. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "subdivision_type": { "label": "Subdivision type 1", "description": "Almost always 'Country'.", "type": "string", "example": "[[List of sovereign states|Country]]" }, "subdivision_name": { "label": "Subdivision name 1", "description": "Depends on 'subdivision_type'. Use the name in text form, e.g., 'United States'. Per MOS:INFOBOXFLAG, flag icons or flag templates may be used in this field.", "type": "string" }, "subdivision_type1": { "label": "Subdivision type 2", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type2": { "label": "Subdivision type 3", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type3": { "label": "Subdivision type 4", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type4": { "label": "Subdivision type 5", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type5": { "label": "Subdivision type 6", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_type6": { "label": "Subdivision type 7", "description": "Additional subdivisions; can be state/province, region, or county.", "type": "string" }, "subdivision_name1": { "label": "Subdivision name 2", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Connecticut]]" }, "subdivision_name2": { "label": "Subdivision name 3", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Florida]]" }, "subdivision_name3": { "label": "Subdivision name 4", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Utah]]" }, "subdivision_name4": { "label": "Subdivision name 5", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[California]]" }, "subdivision_name5": { "label": "Subdivision name 6", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Vermont]]" }, "subdivision_name6": { "label": "Subdivision name 7", "description": "Use the name in text form, e.g., 'Florida' or '[[Florida]]'. Per MOS:INFOBOXFLAG, flag icons or flag templates should not be used in this field.", "type": "string", "example": "[[Wyoming]]" }, "established_title": { "label": "First establishment event", "description": "Title of the first establishment event.", "type": "string", "example": "First settled" }, "established_date": { "label": "First establishment date", "type": "date", "description": "Date of the first establishment event." }, "established_title1": { "label": "Second establishment event", "description": "Title of the second establishment event.", "type": "string", "example": "Incorporated as a town" }, "established_date1": { "label": "Second establishment date", "type": "date", "description": "Date of the second establishment event." }, "established_title2": { "label": "Third establishment event", "description": "Title of the third establishment event.", "type": "string", "example": "Incorporated as a city" }, "established_date2": { "label": "Third establishment date", "type": "date", "description": "Date of the third establishment event." }, "established_title3": { "label": "Fourth establishment event", "type": "string", "description": "Title of the fourth establishment event.", "example": "Incorporated as a county" }, "established_date3": { "label": "Fourth establishment date", "type": "date", "description": "Date of the fourth establishment event." }, "extinct_title": { "label": "Extinction event title", "description": "For when a settlement ceases to exist.", "type": "string", "example": "[[Sack of Rome]]" }, "extinct_date": { "label": "Extinction date", "type": "string", "description": "Date the settlement ceased to exist." }, "founder": { "label": "Founder", "description": "Who the settlement was founded by.", "type": "string" }, "named_for": { "label": "Named for", "description": "The source of the name of the settlement (a person, a place, et cetera).", "type": "string", "example": "[[Ho Chi Minh]]" }, "seat_type": { "label": "Seat of government type", "description": "The label for the seat of government (defaults to 'Seat').", "type": "string", "default": "Seat" }, "seat": { "label": "Seat of government", "description": "The seat of government.", "type": "string", "example": "[[White House]]" }, "parts_type": { "label": "Type of smaller subdivisions", "description": "The label for the smaller subdivisions (defaults to 'Boroughs').", "type": "string", "default": "Boroughs" }, "parts_style": { "label": "Parts style", "description": "Set to 'list' to display as a collapsible list, 'coll' as a collapsed list, or 'para' to use paragraph style. Default is 'list' for up to 5 items, otherwise 'coll'.", "type": "string", "example": "list" }, "parts": { "label": "Smaller subdivisions", "description": "Text or header of the list of smaller subdivisions.", "type": "string" }, "p1": { "label": "Smaller subdivision 1", "description": "The smaller subdivisions to be listed. Parameters 'p1' to 'p50' can also be used.", "type": "string" }, "government_footnotes": { "label": "Government footnotes", "description": "Reference(s) for government. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "content" }, "government_type": { "label": "Government type", "description": "The place's type of government.", "type": "string", "example": "[[Mayor–council government]]" }, "governing_body": { "label": "Governing body", "description": "Name of the place's governing body.", "type": "wiki-page-name", "example": "Legislative Council of Hong Kong" }, "leader_party": { "label": "Leader political party", "description": "Political party of the place's leader.", "type": "string" }, "leader_title": { "label": "Leader title", "description": "First title of the place's leader, e.g. 'Mayor'.", "type": "string", "example": "[[Governor (United States)|Governor]]" }, "leader_name": { "label": "Leader's name", "description": "Name of the place's leader.", "type": "string", "example": "[[Jay Inslee]]" }, "leader_title1": { "label": "Leader title 1", "description": "First title of the place's leader, e.g. 'Mayor'.", "type": "string", "example": "Mayor" }, "leader_name1": { "label": "Leader name 1", "description": "Additional names for leaders. Parameters 'leader_name1' .. 'leader_name4' are available. For long lists, use {{Collapsible list}}.", "type": "string" }, "total_type": { "label": "Total type", "description": "Specifies what total area and population figure refer to, e.g. 'Greater London'. This overrides other labels for total population/area. To make the total area and population display on the same line as the words ''Area'' and ''Population'', with no ''Total'' or similar label, set the value of this parameter to '&nbsp;'.", "type": "string" }, "unit_pref": { "label": "Unit preference", "description": "To change the unit order to 'imperial (metric)', enter 'imperial'. The default display style is 'metric (imperial)'. However, the template will swap the order automatically if the 'subdivision_name' equals some variation of the US or the UK. For the Middle East, a unit preference of dunam can be entered (only affects total area). All values must be entered in a raw format (no commas, spaces, or unit symbols). The template will format them automatically.", "type": "string", "example": "imperial" }, "area_footnotes": { "label": "Area footnotes", "description": "Reference(s) for area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "dunam_link": { "label": "Link dunams?", "description": "If dunams are used, the default is to link the word ''dunams'' in the total area section. This can be changed by setting 'dunam_link' to another measure (e.g. 'dunam_link=water'). Linking can also be turned off by setting the parameter to something else (e.g., 'dunam_link=none' or 'dunam_link=off').", "type": "boolean", "example": "none" }, "area_total_km2": { "label": "Total area (km2)", "description": "Total area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_total_sq_mi' is empty.", "type": "number" }, "area_total_sq_mi": { "label": "Total area (sq. mi)", "description": "Total area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_total_km2' is empty.", "type": "number" }, "area_total_ha": { "label": "Total area (hectares)", "description": "Total area in hectares (symbol: ha). Value must be entered in raw format (no commas or spaces). Auto-converted to display acres if 'area_total_acre' is empty.", "type": "number" }, "area_total_acre": { "label": "Total area (acres)", "description": "Total area in acres. Value must be entered in raw format (no commas or spaces). Auto-converted to display hectares if 'area_total_ha' is empty.", "type": "number" }, "area_total_dunam": { "label": "Total area (dunams)", "description": "Total area in dunams, which is wikilinked. Used in Middle Eastern places like Israel, Gaza, and the West Bank. Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers or hectares and square miles or acres if 'area_total_km2', 'area_total_ha', 'area_total_sq_mi', and 'area_total_acre' are empty. Examples: Gaza and Ramallah.", "type": "number" }, "area_land_km2": { "label": "Land area (sq. km)", "description": "Land area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_land_sq_mi' is empty.", "type": "number" }, "area_land_sq_mi": { "label": "Land area (sq. mi)", "description": "Land area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_land_km2' is empty.", "type": "number" }, "area_land_ha": { "label": "Land area (hectares)", "description": "The place's land area in hectares.", "type": "number" }, "area_land_dunam": { "label": "Land area (dunams)", "description": "The place's land area in dunams.", "type": "number" }, "area_land_acre": { "label": "Land area (acres)", "description": "The place's land area in acres.", "type": "number" }, "area_water_km2": { "label": "Water area (sq. km)", "description": "Water area in square kilometers (symbol: km²). Value must be entered in raw format (no commas or spaces). Auto-converted to display square miles if 'area_water_sq_mi' is empty.", "type": "number" }, "area_water_sq_mi": { "label": "Water area (sq. mi)", "description": "Water area in square miles (symbol: sq mi). Value must be entered in raw format (no commas or spaces). Auto-converted to display square kilometers if 'area_water_km2' is empty.", "type": "number" }, "area_water_ha": { "label": "Water area (hectares)", "description": "The place's water area in hectares.", "type": "number" }, "area_water_dunam": { "label": "Water area (dunams)", "description": "The place's water area in dunams.", "type": "number" }, "area_water_acre": { "label": "Water area (acres)", "description": "The place's water area in acres.", "type": "number" }, "area_water_percent": { "label": "Percent water area", "description": "Percent of water without the %.", "type": "number", "example": "21" }, "area_urban_km2": { "label": "Urban area (sq. km)", "type": "number", "description": "Area of the place's urban area in square kilometers." }, "area_urban_sq_mi": { "label": "Urban area (sq. mi)", "type": "number", "description": "Area of the place's urban area in square miles." }, "area_urban_ha": { "label": "Urban area (hectares)", "description": "Area of the place's urban area in hectares.", "type": "number" }, "area_urban_dunam": { "label": "Urban area (dunams)", "description": "Area of the place's urban area in dunams.", "type": "number" }, "area_urban_acre": { "label": "Urban area (acres)", "description": "Area of the place's urban area in acres.", "type": "number" }, "area_urban_footnotes": { "label": "Urban area footnotes", "description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "area_rural_km2": { "label": "Rural area (sq. km)", "type": "number", "description": "Area of the place's rural area in square kilometers." }, "area_rural_sq_mi": { "label": "Rural area (sq. mi)", "type": "number", "description": "Area of the place's rural area in square miles." }, "area_rural_ha": { "label": "Rural area (hectares)", "description": "Area of the place's rural area in hectares.", "type": "number" }, "area_rural_dunam": { "label": "Rural area (dunams)", "description": "Area of the place's rural area in dunams.", "type": "number" }, "area_rural_acre": { "label": "Rural area (acres)", "description": "Area of the place's rural area in acres.", "type": "number" }, "area_rural_footnotes": { "label": "Rural area footnotes", "description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "area_metro_km2": { "label": "Metropolitan area (sq. km)", "type": "number", "description": "Area of the place's metropolitan area in square kilometers." }, "area_metro_sq_mi": { "label": "Metropolitan area (sq. mi)", "type": "number", "description": "Area of the place's metropolitan area in square miles." }, "area_metro_ha": { "label": "Metropolitan area (hectares)", "description": "Area of the place's metropolitan area in hectares.", "type": "number" }, "area_metro_dunam": { "label": "Metropolitan area (dunams)", "description": "Area of the place's metropolitan area in dunams.", "type": "number" }, "area_metro_acre": { "label": "Metropolitan area (acres)", "description": "Area of the place's metropolitan area in acres.", "type": "number" }, "area_metro_footnotes": { "label": "Metropolitan area footnotes", "description": "Reference(s) for the urban area. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "area_rank": { "label": "Area rank", "description": "The settlement's area, as ranked within its parent sub-division.", "type": "string" }, "area_blank1_title": { "label": "First blank area section title", "description": "Title of the place's first custom area section.", "type": "string", "example": "see [[London]]" }, "area_blank1_km2": { "label": "Area blank 1 (sq. km)", "type": "number", "description": "Area of the place's first blank area section in square kilometers." }, "area_blank1_sq_mi": { "label": "Area blank 1 (sq. mi)", "type": "number", "description": "Area of the place's first blank area section in square miles." }, "area_blank1_ha": { "label": "Area blank 1 (hectares)", "description": "Area of the place's first blank area section in hectares.", "type": "number" }, "area_blank1_dunam": { "label": "Area blank 1 (dunams)", "description": "Area of the place's first blank area section in dunams.", "type": "number" }, "area_blank1_acre": { "label": "Area blank 1 (acres)", "description": "Area of the place's first blank area section in acres.", "type": "number" }, "area_blank2_title": { "label": "Second blank area section title", "type": "string", "description": "Title of the place's second custom area section." }, "area_blank2_km2": { "label": "Area blank 2 (sq. km)", "type": "number", "description": "Area of the place's second blank area section in square kilometers." }, "area_blank2_sq_mi": { "label": "Area blank 2 (sq. mi)", "type": "number", "description": "Area of the place's second blank area section in square miles." }, "area_blank2_ha": { "label": "Area blank 2 (hectares)", "description": "Area of the place's third blank area section in hectares.", "type": "number" }, "area_blank2_dunam": { "label": "Area blank 2 (dunams)", "description": "Area of the place's third blank area section in dunams.", "type": "number" }, "area_blank2_acre": { "label": "Area blank 2 (acres)", "description": "Area of the place's third blank area section in acres.", "type": "number" }, "area_note": { "label": "Area footnotes", "description": "A place for additional information such as the name of the source.", "type": "content", "example": "<ref name=\"CenPopGazetteer2016\">{{cite web|title=2016 U.S. Gazetteer Files|url=https://www2.census.gov/geo/docs/maps-data/data/gazetteer/2016_Gazetteer/2016_gaz_place_42.txt|publisher=United States Census Bureau|access-date=Aug 13, 2017}}</ref>" }, "dimensions_footnotes": { "label": "Dimensions footnotes", "description": "Reference(s) for dimensions. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "content" }, "length_km": { "label": "Length in km", "description": "Raw number entered in kilometers. Will automatically convert to display length in miles if 'length_mi' is empty.", "type": "number" }, "length_mi": { "label": "Length in miles", "description": "Raw number entered in miles. Will automatically convert to display length in kilometers if 'length_km' is empty.", "type": "number" }, "width_km": { "label": "Width in kilometers", "description": "Raw number entered in kilometers. Will automatically convert to display width in miles if 'length_mi' is empty.", "type": "number" }, "width_mi": { "label": "Width in miles", "description": "Raw number entered in miles. Will automatically convert to display width in kilometers if 'length_km' is empty.", "type": "number" }, "elevation_m": { "label": "Elevation in meters", "description": "Raw number entered in meters. Will automatically convert to display elevation in feet if 'elevation_ft' is empty. However, if a range in elevation (i.e. 5–50&nbsp;m) is desired, use the 'max' and 'min' fields below.", "type": "number" }, "elevation_ft": { "label": "Elevation in feet", "description": "Raw number, entered in feet. Will automatically convert to display the average elevation in meters if 'elevation_m' field is empty. However, if a range in elevation (i.e. 50–500&nbsp;ft) is desired, use the 'max' and 'min' fields below.", "type": "number" }, "elevation_footnotes": { "label": "Elevation footnotes", "description": "Reference(s) for elevation. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "elevation_min_point": { "type": "line", "label": "Point of min elevation", "description": "The name of the point of lowest elevation in the place.", "example": "[[Death Valley]]" }, "elevation_min_m": { "label": "Minimum elevation (m)", "type": "number", "description": "The minimum elevation in meters." }, "elevation_min_ft": { "label": "Minimum elevation (ft)", "type": "number", "description": "The minimum elevation in feet." }, "elevation_min_rank": { "type": "line", "label": "Minimum elevation rank", "description": "The point of minimum elevation's rank in the parent region.", "example": "1st" }, "elevation_min_footnotes": { "label": "Min elevation footnotes", "type": "content", "description": "Footnotes or citations for the minimum elevation." }, "elevation_max_point": { "type": "line", "label": "Point of max elevation", "description": "The name of the point of highest elevation in the place.", "example": "[[Mount Everest]]" }, "elevation_max_m": { "label": "Maximum elevation (m)", "type": "number", "description": "The maximum elevation in meters." }, "elevation_max_ft": { "label": "Maximum elevation (ft)", "type": "number", "description": "The maximum elevation in feet." }, "elevation_max_rank": { "type": "line", "label": "Maximum elevation rank", "description": "The point of maximum elevation's rank in the parent region.", "example": "2nd" }, "elevation_max_footnotes": { "label": "Max elevation footnotes", "type": "content", "description": "Footnotes or citations for the maximum elevation." }, "population_total": { "label": "Population total", "description": "Actual population (see below for estimates) preferably consisting of digits only (without any commas).", "type": "number" }, "population_as_of": { "label": "Population total figure's year", "description": "The year for the population total (usually a census year).", "type": "number" }, "population_footnotes": { "label": "Population footnotes", "description": "Reference(s) for population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content" }, "population_density_km2": { "label": "Population density (per square km)", "type": "string", "description": "The place's population density per square kilometer.", "example": "auto" }, "population_density_sq_mi": { "label": "Population density (per square mi)", "type": "string", "description": "The place's population density per square mile.", "example": "auto" }, "population_est": { "label": "Population estimate", "description": "Population estimate, e.g. for growth projections 4 years after a census.", "type": "number", "example": "331000000" }, "pop_est_as_of": { "label": "Population estimate figure as of", "description": "The year, or the month and year, of the population estimate.", "type": "date" }, "pop_est_footnotes": { "label": "Population estimate footnotes", "description": "Reference(s) for population estimate; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content", "example": "<ref name=\"USCensusEst2016\"/>" }, "population_urban": { "label": "Urban population", "type": "number", "description": "The place's urban population." }, "population_urban_footnotes": { "label": "Urban population footnotes", "description": "Reference(s) for urban population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content" }, "population_density_urban_km2": { "label": "Urban population density (per square km)", "type": "string", "description": "The place's urban population density per square kilometer.", "example": "auto" }, "population_density_urban_sq_mi": { "label": "Urban population density (per square mi)", "type": "string", "description": "The place's urban population density per square mile.", "example": "auto" }, "population_rural": { "label": "Rural population", "type": "number", "description": "The place's rural population." }, "population_rural_footnotes": { "label": "Rural population footnotes", "description": "Reference(s) for rural population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "content" }, "population_density_rural_km2": { "label": "Rural population density per sq. km", "type": "line", "description": "The place's rural population density per square kilometer.", "example": "auto" }, "population_density_rural_sq_mi": { "label": "Rural population density per sq. mi", "type": "line", "description": "The place's rural population density per square mile.", "example": "auto" }, "population_metro": { "label": "Metropolitan area population", "type": "number", "description": "Population of the place's metropolitan area." }, "population_metro_footnotes": { "label": "Metropolitan area population footnotes", "description": "Reference(s) for metro population; placed within <nowiki><ref> </ref></nowiki> tags.", "type": "string" }, "population_density_metro_km2": { "label": "Metropolitan population density per sq. km", "type": "number", "description": "The place's metropolitan area's population density per square kilometer.", "example": "auto" }, "population_density_metro_sq_mi": { "label": "Metropolitan population density per sq. mi", "type": "number", "description": "The place's metropolitan area's population density per square mile.", "example": "auto" }, "population_rank": { "label": "Population rank", "description": "The settlement's population, as ranked within its parent sub-division.", "type": "string" }, "population_density_rank": { "label": "Population density rank", "description": "The settlement's population density, as ranked within its parent sub-division.", "type": "string" }, "population_blank1_title": { "label": "Custom population type 1 title", "description": "Can be used for estimates. For an example, see Windsor, Ontario.", "type": "string", "example": "See: [[Windsor, Ontario]]" }, "population_blank1": { "label": "Custom population type 1", "description": "The population value for 'blank1_title'.", "type": "string" }, "population_density_blank1_km2": { "label": "Custom population type 1 density per sq. km", "type": "string", "description": "Population density per square kilometer, according to the 1st custom population type." }, "population_density_blank1_sq_mi": { "label": "Custom population type 1 density per sq. mi", "type": "string", "description": "Population density per square mile, according to the 1st custom population type." }, "population_blank2_title": { "label": "Custom population type 2 title", "description": "Can be used for estimates. For an example, see Windsor, Ontario.", "type": "string", "example": "See: [[Windsor, Ontario]]" }, "population_blank2": { "label": "Custom population type 2", "description": "The population value for 'blank2_title'.", "type": "string" }, "population_density_blank2_km2": { "label": "Custom population type 2 density per sq. km", "type": "string", "description": "Population density per square kilometer, according to the 2nd custom population type." }, "population_density_blank2_sq_mi": { "label": "Custom population type 2 density per sq. mi", "type": "string", "description": "Population density per square mile, according to the 2nd custom population type." }, "population_demonym": { "label": "Demonym", "description": "A demonym or gentilic is a word that denotes the members of a people or the inhabitants of a place. For example, a citizen in Liverpool is known as a Liverpudlian.", "type": "line", "example": "Liverpudlian" }, "population_note": { "label": "Population note", "description": "A place for additional information such as the name of the source. See Windsor, Ontario, for an example.", "type": "content" }, "demographics_type1": { "label": "Demographics type 1", "description": "A sub-section header.", "type": "string", "example": "Ethnicities" }, "demographics1_footnotes": { "label": "Demographics section 1 footnotes", "description": "Reference(s) for demographics section 1. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "content" }, "demographics1_title1": { "label": "Demographics section 1 title 1", "description": "Titles related to demographics_type1. For example: 'White', 'Black', 'Hispanic'... Additional rows 'demographics1_title1' to 'demographics1_title5' are also available.", "type": "string" }, "demographics_type2": { "label": "Demographics type 2", "description": "A second sub-section header.", "type": "line", "example": "Languages" }, "demographics2_footnotes": { "label": "Demographics section 2 footnotes", "description": "Reference(s) for demographics section 2. Placed within <nowiki><ref> </ref></nowiki> tags, possibly using the citing format at {{Cite web}}.", "type": "string" }, "demographics2_title1": { "label": "Demographics section 2 title 1", "description": "Titles related to 'demographics_type1'. For example: 'English', 'French', 'Arabic'... Additional rows 'demographics2_title2' to 'demographics1_title5' are also available.", "type": "string" }, "demographics2_info1": { "label": "Demographics section 2 info 1", "description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics2_info2' to 'demographics2_info5' are also available.", "type": "content" }, "timezone1": { "label": "Timezone 1", "type": "string", "description": "The place's primary time-zone.", "example": "[[Eastern Standard Time]]" }, "utc_offset": { "label": "UTC offset", "type": "string", "description": "The place's time-zone's offset from UTC.", "example": "+8" }, "timezone_DST": { "label": "Timezone during DST", "type": "string", "description": "The place's time-zone during daylight savings time, if applicable.", "example": "[[Eastern Daylight Time]]" }, "utc_offset_DST": { "label": "UTC offset during DST", "type": "string", "description": "The place's time-zone's UTC offset during daylight savings time, if applicable.", "example": "+9" }, "utc_offset1": { "label": "UTC offset 1", "type": "string", "description": "The place's primary time-zone's offset from UTC.", "example": "-5" }, "timezone1_DST": { "label": "Timezone 1 (during DST)", "type": "string", "description": "The place's primary time-zone during daylight savings time, if applicable.", "example": "[[Eastern Daylight Time]]" }, "utc_offset1_DST": { "label": "UTC offset 1 (during DST)", "type": "string", "description": "The place's primary time-zone's UTC offset during daylight savings time, if applicable.", "example": "-6" }, "timezone2": { "label": "Timezone 2", "description": "A second timezone field for larger areas such as a province.", "type": "string", "example": "[[Central Standard Time]]" }, "utc_offset2": { "label": "UTC offset 2", "type": "string", "description": "The place's secondary time-zone's offset from UTC.", "example": "-6" }, "timezone2_DST": { "label": "Timezone 2 during DST", "type": "string", "description": "The place's secondary time-zone during daylight savings time, if applicable.", "example": "[[Central Daylight Time]]" }, "utc_offset2_DST": { "label": "UTC offset 2 during DST", "type": "string", "description": "The place's secondary time-zone's offset from UTC during daylight savings time, if applicable.", "example": "-7" }, "postal_code_type": { "label": "Postal code type", "description": "Label used for postal code info, e.g. 'ZIP Code'. Defaults to 'Postal code'.", "example": "[[Postal code of China|Postal code]]", "type": "string" }, "postal_code": { "label": "Postal code", "description": "The place's postal code/zip code.", "type": "string", "example": "90210" }, "postal2_code_type": { "label": "Postal code 2 type", "type": "string", "description": "If applicable, the place's second postal code type." }, "postal2_code": { "label": "Postal code 2", "type": "string", "description": "A second postal code of the place, if applicable.", "example": "90007" }, "area_code": { "label": "Area code", "description": "The regions' telephone area code.", "type": "string" }, "area_code_type": { "label": "Area code type", "description": "If left blank/not used, template will default to 'Area code(s)'.", "type": "string" }, "geocode": { "label": "Geocode", "description": "See [[Geocode]].", "type": "string" }, "iso_code": { "label": "ISO 3166 code", "description": "See ISO 3166.", "type": "string" }, "registration_plate": { "label": "Registration/license plate info", "description": "See Vehicle registration plate.", "type": "string" }, "blank_name_sec1": { "label": "Blank name section 1", "description": "Fields used to display other information. The name is displayed in bold on the left side of the infobox.", "type": "string" }, "blank_info_sec1": { "label": "Blank info section 1", "description": "The information associated with the 'blank_name_sec1' heading. The info is displayed on the right side of the infobox in the same row as the name. For an example, see [[Warsaw]].", "type": "content" }, "blank1_name_sec1": { "label": "Blank 1 name section 1", "description": "Up to 7 additional fields 'blank1_name_sec1' ... 'blank7_name_sec1' can be specified.", "type": "string" }, "blank1_info_sec1": { "label": "Blank 1 info section 1", "description": "Up to 7 additional fields 'blank1_info_sec1' ... 'blank7_info_sec1' can be specified.", "type": "content" }, "blank_name_sec2": { "label": "Blank name section 2", "description": "For a second section of blank fields.", "type": "string" }, "blank_info_sec2": { "label": "Blank info section 2", "example": "Beijing", "type": "content", "description": "The information associated with the 'blank_name_sec2' heading. The info is displayed on right side of infobox, in the same row as the name. For an example, see [[Warsaw]]." }, "blank1_name_sec2": { "label": "Blank 1 name section 2", "description": "Up to 7 additional fields 'blank1_name_sec2' ... 'blank7_name_sec2' can be specified.", "type": "string" }, "blank1_info_sec2": { "label": "Blank 1 info section 2", "description": "Up to 7 additional fields 'blank1_info_sec2' ... 'blank7_info_sec2' can be specified.", "type": "content" }, "website": { "label": "Official website in English", "description": "External link to official website. Use the {{URL}} template, thus: {{URL|example.com}}.", "type": "string" }, "footnotes": { "label": "Footnotes", "description": "Text to be displayed at the bottom of the infobox.", "type": "content" }, "translit_lang1_info1": { "label": "Language 1 first transcription ", "description": "Transcription of type 1 in the first other language.", "example": "{{lang|zh|森美兰}}", "type": "line" }, "translit_lang1_type1": { "label": "Language 1 first transcription type", "description": "Type of transcription used in the first language's first transcription.", "example": "[[Chinese Language|Chinese]]", "type": "line" }, "translit_lang1_info2": { "label": "Language 1 second transcription ", "description": "Transcription of type 1 in the first other language.", "example": "{{lang|ta|நெகிரி செம்பிலான்}}", "type": "line" }, "translit_lang1_type2": { "label": "Language 1 second transcription type", "description": "Type of transcription used in the first language's first transcription.", "example": "[[Tamil Language|Tamil]]", "type": "line" }, "demographics1_info1": { "label": "Demographics section 1 info 1", "description": "Information related to the titles. For example: '50%', '25%', '10%'... Additional rows 'demographics1_info1' to 'demographics1_info5' are also available.", "type": "content" } } } </templatedata> {{collapse bottom}} ==Calls and redirects == At least {{PAGESINCATEGORY:Templates calling Infobox settlement}} other [[:Category:Templates calling Infobox settlement|templates call this one]]. [{{fullurl:Special:WhatLinksHere/Template:Infobox_settlement|namespace=10&hidetrans=1&hidelinks=1}} Several templates redirect here]. == Tracking categories == # {{clc|Pages using infobox settlement with a dot map}} # {{clc|Pages using infobox settlement with bad settlement type}} # {{clc|Pages using infobox settlement with image map1 but not image map}} # {{clc|Pages using infobox settlement with imprecise region codes}} # {{clc|Pages using infobox settlement with missing country}} # {{clc|Pages using infobox settlement with no map}} # {{clc|Pages using infobox settlement with no coordinates}} # {{clc|Pages using infobox settlement with possible area code list}} # {{clc|Pages using infobox settlement with possible demonym list}} # {{clc|Pages using infobox settlement with possible motto list}} # {{clc|Pages using infobox settlement with possible nickname list}} # {{clc|Pages using infobox settlement with the wikidata parameter}} # {{clc|Pages using infobox settlement with unknown parameters}} # {{clc|Pages using infobox settlement with conflicting parameters}} # {{clc|Pages using infobox settlement with ignored type}} # {{clc|Templates calling Infobox settlement}} <includeonly>{{Sandbox other|| <!--Categories below this line, please; interwikis at Wikidata--> [[Category:Place infobox templates|Settlement]] [[Category:Embeddable templates]] [[Category:Infobox templates using Wikidata]] [[Category:Templates that add a tracking category]] }}</includeonly> 261bc647ae6cc3f45be70aef5b20574388081bf3 Template:Infobox military conflict/doc 10 29 59 58 2023-08-02T22:43:52Z Plantility 2 1 revision imported: Import more infoboxes from Wikipedia (due to laziness) wikitext text/x-wiki {{Documentation subpage}} {{High-use|16,100}} {{Lua|Module:Infobox military conflict}} __TOC__ ==Usage== {{Infobox military conflict | conflict = Battle of Lützen | partof = the [[Thirty Years' War]] | image = Battle of Lutzen.jpg | alt = Battle of Lutzen by Carl Whalbom depicting King Gustavus Aolphus falling from a horse mortally wounded in a melee | image_size = 300px | caption = The '' '''Battle of Lützen''' '' by [[Carl Wahlbom]] shows the death of King [[Gustavus Adolphus]] on 16 November 1632. | date = 6 November ([[Old Style and New Style dates|O.S.]]) or 16 November ([[Old Style and New Style dates|N.S.]]), 1632 | place = Near [[Lützen]], southwest of [[Leipzig]]<br />(present-day [[Germany]]) | coordinates = {{coord|51|15|N|12|08|E|region:DE_type:city}} | result = Protestant victory <br />(see {{blue|Aftermath}} section) | combatant1 = {{flagicon|Sweden|1562}} [[Swedish Empire|Sweden]]<br />[[Protestant Union]] | combatant2 = {{flag|Holy Roman Empire}}<br/>{{flagicon image|Catholic League (Germany).svg}} [[Catholic League (German)|Catholic League]] | commander1 = {{flagicon|Sweden|1562}} [[Gustavus Adolphus]]{{KIA}}<br/>{{flagicon|Sweden|1562}} [[Dodo zu Innhausen und Knyphausen|Dodo von Knyphausen]]<br/>{{Flagicon|Electorate of Saxony}} [[Bernhard of Saxe-Weimar]]<br/>{{flagicon|Sweden|1562}} [[Robert Munro, 18th Baron of Foulis]] | commander2 = {{flagicon|Holy Roman Empire}} [[Albrecht von Wallenstein]]<br/>{{flagicon|Holy Roman Empire}} [[Heinrich Holk]]<br/>{{flagicon|Holy Roman Empire}} [[Gottfried zu Pappenheim|Count Gottfried zu Pappenheim]]{{DOW}} | strength1 = 12,800 infantry<br />6,200 cavalry<br />60 guns | strength2 = 10,000 infantry<br />7,000 cavalry, plus 3,000 infantry and 2,000 cavalry on arrival<br />24 guns | casualties1 = 3,400 dead and 1,600 wounded or missing | casualties2 = Probably about the same as Swedish casualties{{fakeref|1}} }} A military conflict infobox (sometimes referred to as a warbox) may be used to summarize information about a particular military conflict (a battle, campaign, war, or group of related wars) in a standard manner. Information summarized in an infobox should follow the general guidance for writing a [[Wikipedia:Manual of Style/Lead section|lead section]]. It should not "make claims" or present material not covered by the article. As with a lead section, there is some discretion in citing information in an infobox. The same guidance should be applied to an infobox as given for [[Wikipedia:Manual of Style/Lead section#Citations|citations in a lead section]]. Information in an infobox must conform with [[Wikipedia:Verifiability|verifiability]], [[Wikipedia:Neutral point of view|point-of-view]] and other policies. Information in the infobox should not be "controversial". Refer the reader to an appropriate section in the article or leave the parameter blank rather than make an unsubstantiated or doubtful claim. The infobox should be added using the {{tl|infobox military conflict}} template, as shown below: <div style="width:250px;background:#dddddd;border: 1px solid black;padding:0.5em 1em 0.5em 1em"><syntaxhighlight lang="wikitext"> {{Infobox military conflict | conflict = | width = | partof = | image = | image_size = | alt = | caption = | date = | place = | coordinates = <!--Use the {{coord}} template --> | map_type = | map_relief = | map_size = | map_marksize = | map_caption = | map_label = | territory = | result = | status = | combatants_header = | combatant1 = | combatant2 = | combatant3 = | commander1 = | commander2 = | commander3 = | units1 = | units2 = | units3 = | strength1 = | strength2 = | strength3 = | casualties1 = | casualties2 = | casualties3 = | notes = | campaignbox = }} </syntaxhighlight></div> '''Note''': When using parameters, avoid the ambiguous abbreviation "N/A", and instead use "unknown" or "none". All subjective or qualitative judgements and numerical quantities or statistics must be cited to a reliable source (see [[WP:MILMOS#CITE]]). ===Parameters=== * '''conflict''' – the name of the conflict being described (e.g. "Battle of Lützen" or "World War I"). * '''width''' – ''optional'' – the width of the infobox, e.g. "400px"; defaults to: "315px". * '''partof''' – ''optional'' – the larger conflict containing the event described in the article. For battles or campaigns, this should be the war during which the event takes place; for particularly large wars, this may include a theatre (e.g. "the Eastern Front of World War II"). For wars, the parameter may be used to link to a larger group of wars (e.g. the [[Italian War of 1521–26]] to the [[Italian Wars]]). It may be necessary to insert "the" before the name of the war for proper grammar. * '''image''' – ''optional'' – an image for the warbox. Given in the form <code>Example.jpg</code> * '''image_size''' – ''optional'' – a size for the image * '''alt''' – ''optional'' – [[Wikipedia:Manual of Style/Accessibility/Alternative text for images|Alternative text for image]] that is accessible to [[screen reader]]s to help the [[visually impaired]] * '''caption''' – ''optional'' – the text to be placed below the image. * '''date''' – ''optional'' – the date of the conflict described. Convention is to give the actual date for battles and the years for wars, but this does not always apply. * '''place''' – the location of the conflict. For conflicts covering a wide area, a general description (e.g. "France", or "Europe", or "Worldwide") may be used. * '''coordinates''' &ndash; ''optional'' &ndash; the location of the structure, given as a coordinate pair by using {{tl|coord}} with ''display=inline,title''. Used to display the geographic location of the conflict and the location on a map added with the <code>map_type</code> parameter. * '''map_type''' &ndash; ''optional'' &ndash; the base map to be used for the location map, e.g. "Scotland"; see {{tl|location map}} for more details. * '''map_relief''' &ndash; ''optional'' &ndash; "yes" if the location map is a relief map; see {{tl|location map}} for more details. * '''map_size''' &ndash; ''optional'' &ndash; width of the location map in pixels (px), e.g. "150"; defaults to: "220". * '''map_mark''' &ndash; ''optional'' &ndash; the name of a file to use as the location map marker, e.g. Green_pog.svg; defaults to: "Red_pog.svg". * '''map_marksize''' &ndash; ''optional'' &ndash; width of the location map marker in pixels (px), e.g. "10"; defaults to: "8". * '''map_caption''' &ndash; ''optional'' &ndash; caption displayed below the location map; defaults to "Location within {{{map_type}}}", e.g. "Location within Scotland". * '''map_label''' &ndash; ''optional'' &ndash; the label placed next to the marker on the location map. * '''territory''' – ''optional'' – any changes in territorial control as a result of the conflict; this should not be used for overly lengthy descriptions of the peace settlement. * '''action''' – ''optional'' – In case of Coup d'État, short description of ''modus operandi'', e.g. "...marched over the city...", "...dissolving the Congress of the Republic...", "...take the government hostage ...", "...put the country under military control ...", etc. * '''result''' – ''optional'' – this parameter may use one of two standard terms: "X victory" or "Inconclusive". The term used is for the "immediate" outcome of the "subject" conflict and should reflect what the sources say. In cases where the standard terms do not accurately describe the outcome, a link or note should be made to the section of the article where the result is discussed in detail (such as "See the {{blue|Aftermath}} section"). Such a note can also be used in conjunction with the standard terms but should not be used to conceal an ambiguity in the "immediate" result. Do not introduce non-standard terms like "decisive", "marginal" or "tactical", or contradictory statements like "decisive tactical victory but strategic defeat". Omit this parameter altogether rather than engage in [[WP:NOR|speculation]] about which side won or by how much. * '''status''' – ''optional'' – for ongoing conflicts, the current status of the conflict. This should not be used if a final result (above) is provided. * '''combatants_header''' – ''optional'' – sets the header text for the combatants section. Default is "Belligerents". In case of Coup d'État, use "Government-Insurgents&nbsp;&nbsp;&nbsp;" * '''combatant1'''/'''combatant2'''/'''combatant3''' – ''optional'' – the parties participating in the conflict. This is most commonly the countries whose forces took part in the conflict; however, larger groups (such as alliances or international organizations) or smaller ones (such as particular units, formations, or groups) may be indicated if doing so improves reader understanding. When there is a large number of participants, it may be better to list only the three or four major groups on each side of the conflict, and to describe the rest in the body of the article. The '''combatant3''' field may be used if a conflict has three distinct "sides", and should be left blank on other articles. Combatants should be listed in order of importance to the conflict, be it in terms of military contribution, political clout, or a recognized chain of command. If differing metrics can support alternative lists, then ordering is left to the editors of the particular article. The practice of writing in a "Supported by" subheading is deprecated (see [[Template talk:Infobox military conflict#RfC on "supported by" being used with the belligerent parameter|discussion]]). ** '''combatant1a'''/'''combatant2a'''/'''combatant3a''' – ''optional'' – in cases where the parties significantly changed over the course of the conflict, these subsidiary fields may be used to provide additional rows for the '''combatant''N''''' fields (above). ** '''combatant1b'''/'''combatant2b'''/'''combatant3b''' – ''optional'' – additional row, as above. ** '''combatant1c'''/'''combatant2c'''/'''combatant3c''' – ''optional'' – additional row, as above. ** '''combatant1d'''/'''combatant2d'''/'''combatant3d''' – ''optional'' – additional row, as above. ** '''combatant1e'''/'''combatant2e'''/'''combatant3e''' – ''optional'' – additional row, as above. * '''commander1'''/'''commander2'''/'''commander3''' – ''optional'' – the commanders of the military forces involved. For battles, this should include military commanders (and other officers as necessary). For wars, only prominent or notable leaders should be listed, with an upper limit of about seven per combatant column recommended. Ranks and position titles should be omitted. The {{tl|KIA}} and {{tl|POW}} templates may be included immediately after the names of commanders who were killed in action or surrendered and were taken prisoner, respectively. The '''commander3''' field can only be used if the '''combatant3''' field is set. ** '''commander1a'''/'''commander2a'''/'''commander3a''' – ''optional'' – in cases where the commanders significantly changed over the course of the conflict, these subsidiary fields may be used to provide additional rows for the '''commander''N''''' fields (above). ** '''commander1b'''/'''commander2b'''/'''commander3b''' – ''optional'' – additional row, as above. ** '''commander1c'''/'''commander2c'''/'''commander3c''' – ''optional'' – additional row, as above. ** '''commander1d'''/'''commander2d'''/'''commander3d''' – ''optional'' – additional row, as above. ** '''commander1e'''/'''commander2e'''/'''commander3e''' – ''optional'' – additional row, as above. * '''units1'''/'''units2'''/'''units3''' – ''optional'' – the units or formations involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field. The '''units3''' field can only be used if the '''combatant3''' field is set. * '''strength1'''/'''strength2''' – ''optional'' – the numerical strength of the units involved. :* '''polstrength1'''/'''polstrength2''' – ''optional'' – In case of Coup d'Etat, political organizations that supported the government (1) respective the insurgents (2). :* '''milstrength1'''/'''milstrength2''' – ''optional'' – In case of Coup d'Etat, military units that supported the government (1) respective the insurgents (2). * '''strength3''' – ''optional'' – if '''combatant3''' is set, this is a third strength field identical to the two above; if it is '''''not''''' set, this is an alternate combined field for use where only the total participation in a conflict is known. * '''casualties1'''/'''casualties2''' – ''optional'' – casualties suffered (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Note that this section of the infobox is headed "Casualties and losses". Terms such as "dead" (or "killed"), "wounded", or "captured" should be used in place of abbreviations such as "KIA" or "POW". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc. * '''casualties3''' – ''optional'' – if '''combatant3''' is set, this is a third casualty field identical to the two above; if it is '''''not''''' set, this is an alternate combined field for use where only the total casualties of a conflict are known, or where civilian casualties cannot be directly attributed to either side. * '''notes''' – ''optional'' – optional field for further notes; this should only be used in exceptional circumstances. * '''campaignbox''' – ''optional'' – optional field for appending a [[WP:CAMPAIGN|campaignbox template]] to the bottom of the infobox, which allows both boxes to float as a single element (useful if there are subsequent left floating images, which would otherwise not be able to float above the campaign box); the template must be specified in the format <nowiki>{{Campaignbox XYZ}}</nowiki>.<noinclude> [[Category:WikiProject Military history template instructions|Military conflict infobox]] </noinclude>{{Campaign/doc|noheader=yes}} {{Operational plan/doc|noheader=yes}} ==Microformat== {{UF-hcal-geo}} == TemplateData == {{TemplateData header}} {{collapse top|title=TemplateData}} <templatedata> { "description": "Summarize information about a particular military conflict (a battle, campaign, war, or group of related wars).", "format": "{{_\n| _________________ = _\n}}\n", "params": { "conflict": { "label": "Conflict", "description": "The name of the conflict being described.", "type": "string/line", "required": true }, "width": { "label": "Width", "description": "Width of the infobox.", "type": "string", "default": "315px", "required": false }, "partof": { "label": "Part of", "description": "The larger conflict containing the event described in the article.", "type": "wiki-page-name", "required": false }, "image": { "label": "Image", "description": "An image for the warbox given in the form Example.jpg.", "type": "wiki-file-name", "required": false }, "image_size": { "label": "Image size", "description": "The size of the image", "type": "string", "required": false }, "alt": { "label": "Alt", "description": "Alternative textual description of the image", "type": "string", "required": false }, "caption": { "label": "Caption", "description": "The text to be placed below the image.", "type": "string", "required": false }, "date": { "label": "Date", "description": "The date of the conflict described. Convention is to give the actual date for battles and the years for wars, but this does not always apply.", "type": "string", "required": false }, "place": { "label": "Place", "description": "The location of the conflict.", "type": "string", "required": true }, "coordinates": { "label": "Coordinates", "description": "The location of the structure, given as a coordinate pair by using {{coord}} with display=inline,title.", "type": "string", "required": false }, "map_type": { "label": "Map Type", "description": "The base map to be used for the location map, e.g. \"Scotland\"; see {{location map}} for more details.", "type": "string", "required": false }, "map_relief": { "label": "Map Relief", "description": "\"yes\" if the location map is a relief map.", "type": "string", "required": false }, "map_size": { "label": "Map Size", "description": "Width of the location map in pixels (px).", "type": "number", "default": "220", "required": false }, "map_mark": { "label": "Map Marker", "description": "File to use as the location map marker.", "type": "string", "default": "red_pog.svg", "required": false }, "map_marksize": { "label": "Map Marker Size", "description": "Width of the location map marker in pixels (px).", "type": "number", "default": "8", "required": false }, "map_caption": { "label": "Map Caption", "description": "Caption displayed below the location map.", "type": "string", "default": "Location within {{{map_type}}}", "required": false }, "map_label": { "label": "Map Label", "description": "The label placed next to the marker on the location map.", "type": "string/line", "required": false }, "territory": { "label": "Territory", "description": "Any changes in territorial control as a result of the conflict; this should not be used for overly lengthy descriptions of the peace settlement.", "type": "string", "required": false }, "result": { "label": "Result", "description": "This parameter may use one of two standard terms: \"X victory\" or \"Inconclusive\". The term used is for the \"immediate\" outcome of the \"subject\" conflict and should reflect what the sources say. In cases where the standard terms do not accurately describe the outcome, a link or note should be made to the section of the article where the result is discussed in detail (such as \"See the Aftermath section\"). Such a note can also be used in conjunction with the standard terms but should not be used to conceal an ambiguity in the \"immediate\" result. Do not introduce non-standard terms like \"decisive\", \"marginal\" or \"tactical\", or contradictory statements like \"decisive tactical victory but strategic defeat\". Omit this parameter altogether rather than engage in speculation about which side won or by how much.", "type": "string", "required": false }, "status": { "label": "Status", "description": "For ongoing conflicts, the current status of the conflict.", "type": "string/line", "required": false }, "combatants_header": { "label": "\"Combatants\" Header Text", "description": "Sets the header text for the combatants section.", "type": "string/line", "default": "Belligerents", "required": false }, "combatant1": { "label": "Combatant 1", "description": "A party participating in the conflict.", "type": "string", "required": false }, "combatant2": { "label": "Combatant 2", "description": "A party participating in the conflict.", "type": "string", "required": false }, "combatant3": { "label": "Combatant 3", "description": "A party participating in the conflict. (only if the conflict has three distinct \"sides\")", "type": "string", "required": false }, "combatant1a": { "label": "Combatant 1a", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2a": { "label": "Combatant 2a", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3a": { "label": "Combatant 3a", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "combatant1b": { "label": "Combatant 1b", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2b": { "label": "Combatant 2b", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3b": { "label": "Combatant 3b", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "combatant1c": { "label": "Combatant 1c", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2c": { "label": "Combatant 2c", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3c": { "label": "Combatant 3c", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "combatant1d": { "label": "Combatant 1d", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 1 field.", "type": "string", "required": false }, "combatant2d": { "label": "Combatant 2d", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 2 field.", "type": "string", "required": false }, "combatant3d": { "label": "Combatant 3d", "description": "In cases where the parties significantly changed over the course of the conflict, this field may be used to provide additional rows for the Combatant 3 field.", "type": "string", "required": false }, "commander1": { "label": "Commander of Combatant 1", "description": "The commanders of the military forces of Combatant (1) involved.", "type": "string", "required": false }, "commander2": { "label": "Commander of Combatant 2", "description": "The commanders of the military forces of Combatant 2 involved.", "type": "string", "required": false }, "commander3": { "label": "Commander of Combatant 3", "description": "The commanders of the military forces of Combatant 3 involved.", "type": "string", "required": false }, "units1": { "label": "Units of Combatant 1", "description": "The units or formations of Combatant 1 involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field.", "type": "string", "required": false }, "units2": { "label": "Units of Combatant 2", "description": "The units or formations of Combatant 2 involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field.", "type": "string", "required": false }, "units3": { "label": "Units of Combatant 3", "description": "The units or formations of Combatant 3 involved. If a large number of distinct formations is present, it may be better to reference an order of battle in the body of the article than to include the entire list in this field.", "type": "string", "required": false }, "strength1": { "label": "Strength of Combatant 1", "description": "The numerical strength of Combatant 1.", "type": "string", "required": false }, "strength2": { "label": "Strength of Combatant 2", "description": "The numerical strength of Combatant 2.", "type": "string", "required": false }, "strength3": { "label": "Strength of Combatant 3", "description": "If Combatant 3 is set, this field is for the numerical strength of Combatant 3. If Combatant 3 is not set, this is an alternate combined field for use where only the total participation in a conflict is known.", "type": "string", "required": false }, "casualties1": { "label": "Casualties of Combatant 1", "description": "Casualties suffered by Combatant 1 (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Terms such as \"dead\" (or \"killed\"), \"wounded\", or \"captured\" should be used in place of abbreviations such as \"KIA\" or \"POW\". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc.", "type": "string", "required": false }, "casualties2": { "label": "Casualties of Combatant 2", "description": "Casualties suffered by Combatant 2 (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Terms such as \"dead\" (or \"killed\"), \"wounded\", or \"captured\" should be used in place of abbreviations such as \"KIA\" or \"POW\". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc.", "type": "string", "required": false }, "casualties3": { "label": "Casualties of Combatant 3", "description": "If Combatant 3 is set, this field is for the casualties suffered by Combatant 3, (including: dead, wounded, missing, captured and civilian deaths) and equipment losses. Terms such as \"dead\" (or \"killed\"), \"wounded\", or \"captured\" should be used in place of abbreviations such as \"KIA\" or \"POW\". Where equipment losses are reported, this should be confined to major or significant types of equipment broadly categorized such as: tanks, guns (artillery pieces), aircraft, destroyers etc. If combatant3 is not set, this is an alternate combined field for use where only the total casualties of a conflict are known, or where civilian casualties cannot be directly attributed to either side.", "type": "string", "required": false }, "notes": { "label": "Notes", "description": "Optional field for further notes; this should only be used in exceptional circumstances.", "type": "string", "required": false }, "campaignbox": { "label": "Campaignbox", "description": "Optional field for appending a campaignbox template to the bottom of the infobox, which allows both boxes to float as a single element (useful if there are subsequent left floating images, which would otherwise not be able to float above the campaign box); the template must be specified in the format {{Campaignbox XYZ}}.", "type": "string", "required": false } } }</templatedata> {{Collapse bottom}} ==See also== *{{tl|Infobox military operation}} *{{tl|Infobox civil conflict}} *{{tl|Infobox civilian attack}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:War and conflict infobox templates| ]] [[Category:Templates based on the Infobox Lua module]] }}</includeonly> b7bc1bfd8830e6f3810fed38740c84ef509585dd Template:Infobox/doc 10 30 61 60 2023-08-02T22:43:53Z Plantility 2 1 revision imported: Import more infoboxes from Wikipedia (due to laziness) wikitext text/x-wiki {{Documentation subpage}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{distinguish|Template:Userbox}} {{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}} {{Lua|Module:Infobox}} {{Parameter names example |name={{PAGENAME}} <!--|child |subbox |decat--> |title |above |subheader |subheader1 |subheader2={{{subheader2}}}<br/>...... |image|caption |image1|caption1 |image2|caption2={{{caption2}}}<br/>...... |header1=<div style="border-top:1px dashed #ccc;">{{{header1}}}<br/>{{nobold|( ''or'' )}}</div> |label2={{{label1}}} |data2={{{data1}}} |data3=( ''or'' ) |data4=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data1}}}</div> |header5={{{header2}}}<br/><div style="padding:0.75em 0 0.5em;">{{nobold|( ''or'' )}}</div> |label6={{{label2}}} |data6={{{data2}}} |data7=( ''or'' ) |data8=<div style="padding-bottom:0.25em;border-bottom:1px dashed #ccc;">{{{data2}}}</div> |data9=<div style="padding:0.75em 0 0.5em;">( ''etc'' )</div> |below }} This template is intended as a meta template: a template used for constructing other templates. '''Note''': In general, it is not meant for use directly in an article, but can be used on a one-off basis if required (for a template specialized on this usage see {{tl|Unstructured infobox}}). [[Help:Infobox]] contains an introduction about the recommended content and design of infoboxes; [[Wikipedia:Manual of Style/Infoboxes]] contains additional style guidelines. See [[WP:List of infoboxes]] and [[:Category:Infobox templates]] for lists of prepared topic-specific infoboxes. == Usage == {{tlf|Infobox}} is a meta-template: used to organise an actual <nowiki>{{Infobox sometopic}}</nowiki> template (like {{tl|Infobox building}}). For <code><nowiki>[[Template:Infobox sometopic]]</nowiki></code>, template code then looks like this, simplified: <syntaxhighlight lang="wikitext"> {{Infobox | name = {{{name|{{PAGENAME}}}}} | image = {{{image|}}} | caption1 = {{{caption|}}} | label1 = Former names | data1 = {{{former_names|}}} | header2 = General information | label3 = Status | data3 = {{{status|}}} ... <!-- etc. --> }} </syntaxhighlight> == Optional control parameters == ; name : If this parameter is present, "view/talk/edit" links will be added to the bottom of the infobox pointing to the named page, prefixed by <code>Template:</code> if no namespace is specified. You may use the value <nowiki>{{subst:PAGENAME}}</nowiki>; however, this is rarely what you want because it will send users clicking these links in an infobox to the template code rather than the data in the infobox they probably want to change. ; child : See the [[#Embedding|Embedding]] section for details. If this is set to "yes", this child infobox should be titled but have no name parameter. This parameter is empty by default, set it to "yes" to activate it. ; subbox : See the [[#Subboxes|Subboxes]] section for details. If this is set to "yes", this subbox should be titled but have no name parameter. This parameter is empty by default, set to "yes" to activate it. It has no effect if the '''child''' parameter is also set to "yes". ; decat : If this is set to "yes", the current page will not be autocategorized in a maintenance category when the generated infobox has some problems or no visible data section. Leave empty by default or set to "yes" to activate it. ; autoheaders: If this is set to any non-blank value, headers which are not followed by data fields are suppressed. See the "[[#Hiding headers when all its data fields are empty|hiding headers when all its data fields are empty]]" section for more details. == Content parameters == === Title === There are two different ways to put a title on an infobox. One contains the title inside the infobox's border in the uppermost cell of the table, the other puts it as a caption on top of the table. You can use them both together, or just one or the other, or neither (though this is not recommended): ; title : Text to put in the caption over the top of the table (or as section header before the whole content of this table, if this is a child infobox). For [[Wikipedia:Manual of Style/Accessibility#Tables|accessibility reasons]], this is the most recommended alternative. ; above : Text to put within the uppermost cell of the table. ; subheader(n) : additional title fields which fit below {{{title}}} and {{{above}}}, but before images. Examples: {{Infobox | name = Infobox/doc | title = Text in caption over infobox | subheader = Subheader of the infobox | header = (the rest of the infobox goes here) }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | name = {{subst:PAGENAME}} | title = Text in caption over infobox | subheader = Subheader of the infobox | header = (the rest of the infobox goes here) }} </syntaxhighlight>{{clear}} {{Infobox | name = Infobox/doc | above = Text in uppermost cell of infobox | subheader = Subheader of the infobox | subheader2 = Second subheader of the infobox | header = (the rest of the infobox goes here) }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | name = {{subst:PAGENAME}} | above = Text in uppermost cell of infobox | subheader = Subheader of the infobox | subheader2 = Second subheader of the infobox | header = (the rest of the infobox goes here) }} </syntaxhighlight>{{clear}} === Illustration images === ; image(n) : images to display at the top of the template. Use full image syntax, for example <nowiki>[[File:example.png|200px|alt=Example alt text]]</nowiki>. Image is centered by default. See [[WP:ALT]] for more on alt text. ; caption(n) : Text to put underneath the images. === Main data === ; header(n) : Text to use as a header in row n. ; label(n) : Text to use as a label in row n. ; data(n) : Text to display as data in row n. Note: for any given value for (n), not all combinations of parameters are permitted. The presence of a {{para|header''(n)''}} will cause the corresponding {{para|data''(n)''}} (and {{para|rowclass''(n)''}} {{para|label''(n)''}}, see below) to be ignored; the absence of a {{para|data''(n)''}} will cause the corresponding {{para|label''(n)''}} to be ignored. Valid combinations for any single row are: * {{para|class''(n)''}} {{para|header''(n)''}} * {{para|rowclass''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}} * {{para|rowclass''(n)''}} {{para|label''(n)''}} {{para|class''(n)''}} {{para|data''(n)''}} See the rendering of header4, label4, and data4 in the [[#Examples|Examples]] section below. ==== Number ranges ==== To allow flexibility when the layout of an infobox is changed, it may be helpful when developing an infobox to use non-contiguous numbers for header and label/data rows. Parameters for new rows can then be inserted in future without having to renumber existing parameters. For example: <syntaxhighlight lang="wikitext" style="overflow:auto"> | header3 = Section 1 | label5 = Label A | data5 = Data A | label7 = Label C | data7 = Data C | header10 = Section 2 | label12 = Label D | data12 = Data D </syntaxhighlight>{{clear}} It is also possible to automatically renumber parameter names by using [[User:Frietjes/infoboxgap.js]] or [[Module:IncrementParams]]. There is no upper limit on numbers but there must be at most 50 between each used number. ==== Making data fields optional ==== A row with a label but no data is not displayed. This allows for the easy creation of optional infobox content rows. To make a row optional use a parameter that defaults to an empty string, like so: <syntaxhighlight lang="wikitext" style="overflow:auto"> | label5 = Population | data5 = {{{population|}}} </syntaxhighlight>{{clear}} This way if an article doesn't define the population parameter in its infobox the row won't be displayed. For more complex fields with pre-formatted contents that would still be present even if the parameter wasn't set, you can wrap it all in an "#if" statement to make the whole thing vanish when the parameter is not used. For instance, the "#if" statement in the following example reads "#if:the parameter ''mass'' has been supplied |then display it, followed by 'kg'": <syntaxhighlight lang="wikitext" style="overflow:auto"> | label6 = Mass | data6 = {{ #if: {{{mass|}}} | {{{mass}}} kg }} </syntaxhighlight>{{clear}} For more on #if, see [[meta:ParserFunctions##if:|here]]. ==== Hiding headers when all its data fields are empty ==== You can also make headers automatically hide when their section is empty (has no data-row showing). Consider this situation: {{Infobox | title = Example: header with & without data | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Example: header with & without data | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} </syntaxhighlight>{{clear}} If you want hide the header when no {{para|data''N''}} values are present, use '''{{para|autoheaders|y}}''': {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = Header5 with data below | label6 = label6 text | data6 = Some value }} </syntaxhighlight>{{clear}} So, header1 will be shown if any of item1, item2, or item3 is defined. If none of the three parameters are defined the header won't be shown and no empty row appears before the next visible content. Note: if the data has empty css elements, like {{para|data|2=&lt;span style="background:yellow;">&lt;/span>}}, this will be treated as non-empty (having data). If {{para|autoheaders|y}} but there are items that you ''do not'' want to trigger a header, place {{para|headerX|_BLANK_}}. This will serve as an empty header and separate it from the subsequent items. {{Infobox | title = Example: blank header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = _BLANK_ | label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5 }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Example: header with & without data | autoheaders = y | headerstyle = background:lightgrey | header1 = Header1 with empty section | label2 = label2 text | data2 = | label3 = label3 text | data3 = | label4 = label4 text | data4 = | header5 = _BLANK_ | label6 = label6 text | data6 = Some value, but does not trigger header1 or show header5 }} </syntaxhighlight>{{clear}} === Footer === ; below : Text to put in the bottom cell. The bottom cell is intended for footnotes, see-also, and other such information. == Presentation parameters == === Italic titles === Titles of articles with infoboxes may be made italic, in line with [[WP:ITALICTITLE]], by passing the <code>italic title</code> parameter. * Turn on italic titles by passing {{para|italic title|<nowiki>{{{italic title|}}}</nowiki>}} from the infobox. * Turn off by default (notably because only Latin script may be safely rendered in this style and italic may be needed to distinguish foreign language from local English language only in that script, but would be difficult to read for other scripts) but allow some instances to be made italic by passing {{para|italic title|<nowiki>{{{italic title|no}}}</nowiki>}} * Do not make any titles italic by not passing the parameter at all. === CSS styling === {{div col}} ; bodystyle : Applies to the infobox table as a whole ; titlestyle : Applies only to the title caption. Adding a background color is usually inadvisable since the text is rendered "outside" the infobox. ; abovestyle : Applies only to the "above" cell at the top. The default style has font-size:125%; since this cell is usually used for a title, if you want to use the above cell for regular-sized text include "font-size:100%;" in the abovestyle. ; imagestyle : Applies to the cell the image is in. This includes the text of the image caption, but you should set text properties with captionstyle instead of imagestyle in case the caption is moved out of this cell in the future. ; captionstyle : Applies to the text of the image caption. ; rowstyle(n) : This parameter is inserted into the <code>style</code> attribute for the specified row. ; headerstyle : Applies to all header cells ; subheaderstyle : Applies to all subheader cells ; labelstyle : Applies to all label cells ; datastyle : Applies to all data cells ; belowstyle : Applies only to the below cell {{div col end}} === HTML classes and microformats === {{div col}} ; bodyclass : This parameter is inserted into the <code>class</code> attribute for the infobox as a whole. ; titleclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''title''' caption. <!-- currently not implemented in Lua module ; aboverowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''above''' cell is on. --> ; aboveclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''above''' cell. ; subheaderrowclass(n) : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''subheader''' is on. ; subheaderclass(n) : This parameter is inserted into the <code>class</code> attribute for the infobox's '''subheader'''. ; imagerowclass(n) : These parameters are inserted into the <code>class</code> attribute for the complete table row their respective '''image''' is on. ; imageclass : This parameter is inserted into the <code>class</code> attribute for the '''image'''. ; rowclass(n) : This parameter is inserted into the <code>class</code> attribute for the specified row including the '''label''' and '''data''' cells. ; class(n) : This parameter is inserted into the <code>class</code> attribute for the '''data''' cell of the specified row. If there's no '''data''' cell it has no effect. <!-- currently not implemented in Lua module ; belowrowclass : This parameter is inserted into the <code>class</code> attribute for the complete table row the '''below''' cell is on. --> ; belowclass : This parameter is inserted into the <code>class</code> attribute for the infobox's '''below''' cell. {{div col end}} This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. Multiple class names may be specified, separated by spaces, some of them being used as selectors for custom styling according to a project policy or to the skin selected in user preferences, others being used for microformats. To flag an infobox as containing [[hCard]] information, for example, add the following parameter: <syntaxhighlight lang="wikitext" style="overflow:auto"> | bodyclass = vcard </syntaxhighlight>{{clear}} And for each row containing a data cell that's part of the vcard, add a corresponding class parameter: <syntaxhighlight lang="wikitext" style="overflow:auto"> | class1 = fn | class2 = org | class3 = tel </syntaxhighlight>{{clear}} ...and so forth. "above" and "title" can also be given classes, since these are usually used to display the name of the subject of the infobox. See [[Wikipedia:WikiProject Microformats]] for more information on adding microformat information to Wikipedia, and [[microformat]] for more information on microformats in general. == Examples == Notice how the row doesn't appear in the displayed infobox when a '''label''' is defined without an accompanying '''data''' cell, and how all of them are displayed when a '''header''' is defined on the same row as a '''data''' cell. Also notice that '''subheaders''' are not bold by default like the '''headers''' used to split the main data section, because this role is meant to be for the '''above''' cell : {{Infobox |name = Infobox/doc |bodystyle = |titlestyle = |abovestyle = background:#cfc; |subheaderstyle = |title = Test Infobox |above = Above text |subheader = Subheader above image |subheader2 = Second subheader |imagestyle = |captionstyle = |image = [[File:Example-serious.jpg|200px|alt=Example alt text]] |caption = Caption displayed below File:Example-serious.jpg |headerstyle = background:#ccf; |labelstyle = background:#ddf; |datastyle = |header1 = Header defined alone | label1 = | data1 = |header2 = | label2 = Label defined alone does not display (needs data, or is suppressed) | data2 = |header3 = | label3 = | data3 = Data defined alone |header4 = All three defined (header, label, data, all with same number) | label4 = does not display (same number as a header) | data4 = does not display (same number as a header) |header5 = | label5 = Label and data defined (label) | data5 = Label and data defined (data) |belowstyle = background:#ddf; |below = Below text }} <syntaxhighlight lang="wikitext"> {{Infobox |name = Infobox/doc |bodystyle = |titlestyle = |abovestyle = background:#cfc; |subheaderstyle = |title = Test Infobox |above = Above text |subheader = Subheader above image |subheader2 = Second subheader |imagestyle = |captionstyle = |image = [[File:Example-serious.jpg|200px|alt=Example alt text]] |caption = Caption displayed below File:Example-serious.jpg |headerstyle = background:#ccf; |labelstyle = background:#ddf; |datastyle = |header1 = Header defined alone | label1 = | data1 = |header2 = | label2 = Label defined alone does not display (needs data, or is suppressed) | data2 = |header3 = | label3 = | data3 = Data defined alone |header4 = All three defined (header, label, data, all with same number) | label4 = does not display (same number as a header) | data4 = does not display (same number as a header) |header5 = | label5 = Label and data defined (label) | data5 = Label and data defined (data) |belowstyle = background:#ddf; |below = Below text }} </syntaxhighlight> For this example, the {{para|bodystyle}} and {{para|labelstyle}} parameters are used to adjust the infobox width and define a default width for the column of labels: {{Infobox |name = Infobox/doc |bodystyle = width:20em |titlestyle = |title = Test Infobox |headerstyle = |labelstyle = width:33% |datastyle = |header1 = | label1 = Label 1 | data1 = Data 1 |header2 = | label2 = Label 2 | data2 = Data 2 |header3 = | label3 = Label 3 | data3 = Data 3 |header4 = Header 4 | label4 = | data4 = |header5 = | label5 = Label 5 | data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |belowstyle = |below = Below text }} <syntaxhighlight lang="wikitext"> {{Infobox |name = Infobox/doc |bodystyle = width:20em |titlestyle = |title = Test Infobox |headerstyle = |labelstyle = width:33% |datastyle = |header1 = | label1 = Label 1 | data1 = Data 1 |header2 = | label2 = Label 2 | data2 = Data 2 |header3 = | label3 = Label 3 | data3 = Data 3 |header4 = Header 4 | label4 = | data4 = |header5 = | label5 = Label 5 | data5 = Data 5: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |belowstyle = |below = Below text }} </syntaxhighlight> == Embedding == <!--Linked from [[Template:Subinfobox bodystyle/doc]]--> One infobox template can be embedded into another using the {{para|child}} parameter. This feature can be used to create a modular infobox, or to create better-defined logical sections. Long ago, it was necessary to use embedding in order to create infoboxes with more than 99 rows; but nowadays there's no limit to the number of rows that can be defined in a single instance of <code><nowiki>{{infobox}}</nowiki></code>. {{Infobox | title = Top level title | data1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | data2 = {{Infobox | decat = yes | child = yes |title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Top level title | data1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | data2 = {{Infobox | decat = yes | child = yes |title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} </syntaxhighlight>{{clear}} Note, in the examples above, the child infobox is placed in a <code>data</code> field, not a <code>header</code> field. Notice that the section subheadings are not in bold font if bolding is not explicitly specified. To obtain bold section headings, place the child infobox in a '''header''' field (but not in a '''label''' field because it would not be displayed!), either using {{Infobox | title = Top level title | header1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | header2 = {{Infobox | decat = yes | child = yes | title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Top level title | header1 = {{Infobox | decat = yes | child = yes | title = First subsection | label1= Label 1.1 | data1 = Data 1.1 }} | header2 = {{Infobox | decat = yes | child = yes | title = Second subsection | label1= Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} </syntaxhighlight>{{clear}} or, {{Infobox | title = Top level title | header1 = First subsection {{Infobox | decat = yes | child = yes | label1 = Label 1.1 | data1 = Data 1.1 }} | header2 = Second subsection {{Infobox | decat = yes | child = yes | label1 = Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | title = Top level title | header1 = First subsection {{Infobox | decat = yes | child = yes | label1 = Label 1.1 | data1 = Data 1.1 }} | header2 = Second subsection {{Infobox | decat = yes | child = yes | label1 = Label 2.1 | data1 = Data 2.1 }} | belowstyle = | below = Below text }} </syntaxhighlight>{{clear}} Note that omitting the {{para|title}} parameter, and not including any text preceding the embedded infobox, may result in spurious blank table rows, creating gaps in the visual presentation. The garbage output can be suppressed using {{para|rowstyleN|display: none}}, replacing N with the data/header number. [[Wikipedia:WikiProject Infoboxes/embed]] includes some links to Wikipedia articles which include infoboxes embedded within other infoboxes. == Subboxes == An alternative method for embedding is to use {{para|subbox|yes}}, which removes the outer border from the infobox, but preserves the interior structure. One feature of this approach is that the parent and child boxes need not have the same structure, and the label and data fields are not aligned between the parent and child boxes because they are not in the same parent table. {{Infobox | headerstyle = background-color:#eee; | labelstyle = background-color:#eee; | header1 = Main 1 | header2 = Main 2 | data3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | data4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | label5 = Label 5 | data5 = Data 5 | header6 = Main 6 }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | headerstyle = background-color:#eee; | labelstyle = background-color:#eee; | header1 = Main 1 | header2 = Main 2 | data3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | data4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | label5 = Label 5 | data5 = Data 5 | header6 = Main 6 }} </syntaxhighlight>{{clear}} Similar embedding techniques may be used within content parameters of some other templates generating tables (such as [[:Template:Sidebar|Sidebar]]) : {{Sidebar | navbar = off | headingstyle = background-color:#eee; | heading1 = Heading 1 | heading2 = Heading 2 | content3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | content4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | heading5 = Heading 5 }} <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Sidebar | navbar = off | headingstyle = background-color:#eee; | heading1 = Heading 1 | heading2 = Heading 2 | content3 = {{Infobox | subbox = yes | headerstyle = background-color:#ccc; | labelstyle = background-color:#ddd; | header1 = Sub 3-1 | header2 = Sub 3-2 | label3 = Label 3-3 | data3 = Data 3-3 }} | content4 = {{Infobox | subbox = yes | labelstyle = background-color:#ccc; | label1 = Label 4-1 | data1 = Data 4-1 }} | heading5 = Heading 5 }} </syntaxhighlight>{{clear}} Note that the default padding of the parent data cell containing each subbox is still visible, so the subboxes are slightly narrower than the parent box and there's a higher vertical spacing between standard cells of the parent box than between cells of distinct subboxes. == Controlling line-breaking in embedded bulletless lists == Template {{tlx|nbsp}} may be used with {{tlx|wbr}} and {{tlx|nowrap}} to control line-breaking in bulletless lists embedded in infoboxes (e.g. cast list in {{tlx|Infobox film}}), to prevent wrapped long entries from being confused with multiple entries. See [[Template:Wbr/doc#Controlling line-breaking in infoboxes]] for details. == Full blank syntax == (Note: there is no limit to the number of possible rows; only 20 are given below since infoboxes larger than that will be relatively rare. Just extend the numbering as needed. The microformat "class" parameters are also omitted as they are not commonly used.) <syntaxhighlight lang="wikitext" style="overflow:auto"> {{Infobox | name = {{subst:PAGENAME}} | child = {{{child|}}} | subbox = {{{subbox|}}} | italic title = {{{italic title|no}}} | templatestyles = | child templatestyles = | grandchild templatestyles = | bodystyle = | titlestyle = | abovestyle = | subheaderstyle = | title = | above = | subheader = | imagestyle = | captionstyle = | image = | caption = | image2 = | caption2 = | headerstyle = | labelstyle = | datastyle = | header1 = | label1 = | data1 = | header2 = | label2 = | data2 = | header3 = | label3 = | data3 = | header4 = | label4 = | data4 = | header5 = | label5 = | data5 = | header6 = | label6 = | data6 = | header7 = | label7 = | data7 = | header8 = | label8 = | data8 = | header9 = | label9 = | data9 = | header10 = | label10 = | data10 = | header11 = | label11 = | data11 = | header12 = | label12 = | data12 = | header13 = | label13 = | data13 = | header14 = | label14 = | data14 = | header15 = | label15 = | data15 = | header16 = | label16 = | data16 = | header17 = | label17 = | data17 = | header18 = | label18 = | data18 = | header19 = | label19 = | data19 = | header20 = | label20 = | data20 = | belowstyle = | below = }} </syntaxhighlight>{{clear}} {{Help:Infobox/user style}} == Porting to other MediaWikis == The infobox template requires the [[:mw:Extension:Scribunto|Scribunto]] and [[:mw:Extension:TemplateStyles|TemplateStyles]] extensions. [[Wikipedia:WikiProject Transwiki|WikiProject Transwiki]] has a version of this template that has been modified to work on other MediaWikis. == TemplateData == {{TemplateData header}} <templatedata> { "description": "This template is intended as a meta template, a template used for constructing other templates. In general, it is not meant for use directly in an article but can be used on a one-off basis if required.", "format": "{{_\n| ________________ = _\n}}\n", "params": { "title": { "label": "Title", "description": "Title displayed above the infobox", "type": "string", "suggested": true }, "image": { "label": "Image", "description": "Image illustrating the topic. Use full image syntax.", "type": "content", "suggested": true, "example": "[[File:example.png|200px|alt=Example alt text]]" }, "caption": { "label": "Caption", "description": "caption for the image", "type": "content", "suggested": true } }, "paramOrder": [ "title", "image", "caption" ] } </templatedata> ==Tracking categories== * {{Category link with count|Articles with missing Wikidata information}} * {{Category link with count|Articles using infobox templates with no data rows}} * {{Category link with count|Pages using embedded infobox templates with the title parameter}} ==See also== * [[Module:Infobox]], the [[WP:LUA|Lua]] module on which this template is based * [[Module:Check for unknown parameters]] * {{tl|Unstructured infobox}} * {{tl|Infobox3cols}} * {{tl|Navbox}} and {{tl|Sidebar}} * [[Wikipedia:List of infoboxes|List of infoboxes]] * [[:Module:InfoboxImage]] <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:Infobox templates| ]] [[Category:Wikipedia metatemplates|Infobox]] [[Category:Templates generating microformats]] [[Category:Templates that add a tracking category]] [[Category:Templates based on the Infobox Lua module]] }}</includeonly> 8c47f082bd0a0c1ce81004d6651c34c61b7d2403 Module:Documentation 828 33 67 66 2023-08-02T22:45:49Z Plantility 2 1 revision imported: Import documentation module from Wikipedia Scribunto text/plain -- This module implements {{documentation}}. -- Get required modules. local getArgs = require('Module:Arguments').getArgs -- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local p = {} -- Often-used functions. local ugsub = mw.ustring.gsub local format = mw.ustring.format ---------------------------------------------------------------------------- -- Helper functions -- -- These are defined as local functions, but are made available in the p -- table for testing purposes. ---------------------------------------------------------------------------- local function message(cfgKey, valArray, expectType) --[[ -- Gets a message from the cfg table and formats it if appropriate. -- The function raises an error if the value from the cfg table is not -- of the type expectType. The default type for expectType is 'string'. -- If the table valArray is present, strings such as $1, $2 etc. in the -- message are substituted with values from the table keys [1], [2] etc. -- For example, if the message "foo-message" had the value 'Foo $2 bar $1.', -- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz." --]] local msg = cfg[cfgKey] expectType = expectType or 'string' if type(msg) ~= expectType then error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) end if not valArray then return msg end local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4) end return ugsub(msg, '$([1-9][0-9]*)', getMessageVal) end p.message = message local function makeWikilink(page, display) if display then return format('[[%s|%s]]', page, display) else return format('[[%s]]', page) end end p.makeWikilink = makeWikilink local function makeCategoryLink(cat, sort) local catns = mw.site.namespaces[14].name return makeWikilink(catns .. ':' .. cat, sort) end p.makeCategoryLink = makeCategoryLink local function makeUrlLink(url, display) return format('[%s %s]', url, display) end p.makeUrlLink = makeUrlLink local function makeToolbar(...) local ret = {} local lim = select('#', ...) if lim < 1 then return nil end for i = 1, lim do ret[#ret + 1] = select(i, ...) end -- 'documentation-toolbar' return format( '<span class="%s">(%s)</span>', message('toolbar-class'), table.concat(ret, ' &#124; ') ) end p.makeToolbar = makeToolbar ---------------------------------------------------------------------------- -- Argument processing ---------------------------------------------------------------------------- local function makeInvokeFunc(funcName) return function (frame) local args = getArgs(frame, { valueFunc = function (key, value) if type(value) == 'string' then value = value:match('^%s*(.-)%s*$') -- Remove whitespace. if key == 'heading' or value ~= '' then return value else return nil end else return value end end }) return p[funcName](args) end end ---------------------------------------------------------------------------- -- Entry points ---------------------------------------------------------------------------- function p.nonexistent(frame) if mw.title.getCurrentTitle().subpageText == 'testcases' then return frame:expandTemplate{title = 'module test cases notice'} else return p.main(frame) end end p.main = makeInvokeFunc('_main') function p._main(args) --[[ -- This function defines logic flow for the module. -- @args - table of arguments passed by the user --]] local env = p.getEnvironment(args) local root = mw.html.create() root :wikitext(p._getModuleWikitext(args, env)) :wikitext(p.protectionTemplate(env)) :wikitext(p.sandboxNotice(args, env)) :tag('div') -- 'documentation-container' :addClass(message('container')) :attr('role', 'complementary') :attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil) :attr('aria-label', args.heading == '' and 'Documentation' or nil) :newline() :tag('div') -- 'documentation' :addClass(message('main-div-classes')) :newline() :wikitext(p._startBox(args, env)) :wikitext(p._content(args, env)) :tag('div') -- 'documentation-clear' :addClass(message('clear')) :done() :newline() :done() :wikitext(p._endBox(args, env)) :done() :wikitext(p.addTrackingCategories(env)) -- 'Module:Documentation/styles.css' return mw.getCurrentFrame():extensionTag ( 'templatestyles', '', {src=cfg['templatestyles'] }) .. tostring(root) end ---------------------------------------------------------------------------- -- Environment settings ---------------------------------------------------------------------------- function p.getEnvironment(args) --[[ -- Returns a table with information about the environment, including title -- objects and other namespace- or path-related data. -- @args - table of arguments passed by the user -- -- Title objects include: -- env.title - the page we are making documentation for (usually the current title) -- env.templateTitle - the template (or module, file, etc.) -- env.docTitle - the /doc subpage. -- env.sandboxTitle - the /sandbox subpage. -- env.testcasesTitle - the /testcases subpage. -- -- Data includes: -- env.protectionLevels - the protection levels table of the title object. -- env.subjectSpace - the number of the title's subject namespace. -- env.docSpace - the number of the namespace the title puts its documentation in. -- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace. -- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template. -- -- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value -- returned will be nil. --]] local env, envFuncs = {}, {} -- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value -- returned by that function is memoized in the env table so that we don't call any of the functions -- more than once. (Nils won't be memoized.) setmetatable(env, { __index = function (t, key) local envFunc = envFuncs[key] if envFunc then local success, val = pcall(envFunc) if success then env[key] = val -- Memoise the value. return val end end return nil end }) function envFuncs.title() -- The title object for the current page, or a test page passed with args.page. local title local titleArg = args.page if titleArg then title = mw.title.new(titleArg) else title = mw.title.getCurrentTitle() end return title end function envFuncs.templateTitle() --[[ -- The template (or module, etc.) title object. -- Messages: -- 'sandbox-subpage' --> 'sandbox' -- 'testcases-subpage' --> 'testcases' --]] local subjectSpace = env.subjectSpace local title = env.title local subpage = title.subpageText if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') then return mw.title.makeTitle(subjectSpace, title.baseText) else return mw.title.makeTitle(subjectSpace, title.text) end end function envFuncs.docTitle() --[[ -- Title object of the /doc subpage. -- Messages: -- 'doc-subpage' --> 'doc' --]] local title = env.title local docname = args[1] -- User-specified doc page. local docpage if docname then docpage = docname else docpage = env.docpageBase .. '/' .. message('doc-subpage') end return mw.title.new(docpage) end function envFuncs.sandboxTitle() --[[ -- Title object for the /sandbox subpage. -- Messages: -- 'sandbox-subpage' --> 'sandbox' --]] return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage')) end function envFuncs.testcasesTitle() --[[ -- Title object for the /testcases subpage. -- Messages: -- 'testcases-subpage' --> 'testcases' --]] return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) end function envFuncs.protectionLevels() -- The protection levels table of the title object. return env.title.protectionLevels end function envFuncs.subjectSpace() -- The subject namespace number. return mw.site.namespaces[env.title.namespace].subject.id end function envFuncs.docSpace() -- The documentation namespace number. For most namespaces this is the -- same as the subject namespace. However, pages in the Article, File, -- MediaWiki or Category namespaces must have their /doc, /sandbox and -- /testcases pages in talk space. local subjectSpace = env.subjectSpace if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then return subjectSpace + 1 else return subjectSpace end end function envFuncs.docpageBase() -- The base page of the /doc, /sandbox, and /testcases subpages. -- For some namespaces this is the talk page, rather than the template page. local templateTitle = env.templateTitle local docSpace = env.docSpace local docSpaceText = mw.site.namespaces[docSpace].name -- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon. return docSpaceText .. ':' .. templateTitle.text end function envFuncs.compareUrl() -- Diff link between the sandbox and the main template using [[Special:ComparePages]]. local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle if templateTitle.exists and sandboxTitle.exists then local compareUrl = mw.uri.canonicalUrl( 'Special:ComparePages', { page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText} ) return tostring(compareUrl) else return nil end end return env end ---------------------------------------------------------------------------- -- Auxiliary templates ---------------------------------------------------------------------------- p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext') function p._getModuleWikitext(args, env) local currentTitle = mw.title.getCurrentTitle() if currentTitle.contentModel ~= 'Scribunto' then return end pcall(require, currentTitle.prefixedText) -- if it fails, we don't care local moduleWikitext = package.loaded["Module:Module wikitext"] if moduleWikitext then return moduleWikitext.main() end end function p.sandboxNotice(args, env) --[=[ -- Generates a sandbox notice for display above sandbox pages. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]' -- 'sandbox-notice-blurb' --> 'This is the $1 for $2.' -- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).' -- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page' -- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page' -- 'sandbox-notice-pagetype-other' --> 'sandbox page' -- 'sandbox-notice-compare-link-display' --> 'diff' -- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.' -- 'sandbox-notice-testcases-link-display' --> 'test cases' -- 'sandbox-category' --> 'Template sandboxes' --]=] local title = env.title local sandboxTitle = env.sandboxTitle local templateTitle = env.templateTitle local subjectSpace = env.subjectSpace if not (subjectSpace and title and sandboxTitle and templateTitle and mw.title.equals(title, sandboxTitle)) then return nil end -- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text". local omargs = {} omargs.image = message('sandbox-notice-image') -- Get the text. We start with the opening blurb, which is something like -- "This is the template sandbox for [[Template:Foo]] (diff)." local text = '' local pagetype if subjectSpace == 10 then pagetype = message('sandbox-notice-pagetype-template') elseif subjectSpace == 828 then pagetype = message('sandbox-notice-pagetype-module') else pagetype = message('sandbox-notice-pagetype-other') end local templateLink = makeWikilink(templateTitle.prefixedText) local compareUrl = env.compareUrl if compareUrl then local compareDisplay = message('sandbox-notice-compare-link-display') local compareLink = makeUrlLink(compareUrl, compareDisplay) text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink}) else text = text .. message('sandbox-notice-blurb', {pagetype, templateLink}) end -- Get the test cases page blurb if the page exists. This is something like -- "See also the companion subpage for [[Template:Foo/testcases|test cases]]." local testcasesTitle = env.testcasesTitle if testcasesTitle and testcasesTitle.exists then if testcasesTitle.contentModel == "Scribunto" then local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink}) else local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay) text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink}) end end -- Add the sandbox to the sandbox category. omargs.text = text .. makeCategoryLink(message('sandbox-category')) -- 'documentation-clear' return '<div class="' .. message('clear') .. '"></div>' .. require('Module:Message box').main('ombox', omargs) end function p.protectionTemplate(env) -- Generates the padlock icon in the top right. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'protection-template' --> 'pp-template' -- 'protection-template-args' --> {docusage = 'yes'} local protectionLevels = env.protectionLevels if not protectionLevels then return nil end local editProt = protectionLevels.edit and protectionLevels.edit[1] local moveProt = protectionLevels.move and protectionLevels.move[1] if editProt then -- The page is edit-protected. return require('Module:Protection banner')._main{ message('protection-reason-edit'), small = true } elseif moveProt and moveProt ~= 'autoconfirmed' then -- The page is move-protected but not edit-protected. Exclude move -- protection with the level "autoconfirmed", as this is equivalent to -- no move protection at all. return require('Module:Protection banner')._main{ action = 'move', small = true } else return nil end end ---------------------------------------------------------------------------- -- Start box ---------------------------------------------------------------------------- p.startBox = makeInvokeFunc('_startBox') function p._startBox(args, env) --[[ -- This function generates the start box. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make -- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox -- which generate the box HTML. --]] env = env or p.getEnvironment(args) local links local content = args.content if not content or args[1] then -- No need to include the links if the documentation is on the template page itself. local linksData = p.makeStartBoxLinksData(args, env) if linksData then links = p.renderStartBoxLinks(linksData) end end -- Generate the start box html. local data = p.makeStartBoxData(args, env, links) if data then return p.renderStartBox(data) else -- User specified no heading. return nil end end function p.makeStartBoxLinksData(args, env) --[[ -- Does initial processing of data to make the [view] [edit] [history] [purge] links. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'view-link-display' --> 'view' -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'purge-link-display' --> 'purge' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'docpage-preload' --> 'Template:Documentation/preload' -- 'create-link-display' --> 'create' --]] local subjectSpace = env.subjectSpace local title = env.title local docTitle = env.docTitle if not title or not docTitle then return nil end if docTitle.isRedirect then docTitle = docTitle.redirectTarget end -- Create link if /doc doesn't exist. local preload = args.preload if not preload then if subjectSpace == 828 then -- Module namespace preload = message('module-preload') else preload = message('docpage-preload') end end return { title = title, docTitle = docTitle, -- View, display, edit, and purge links if /doc exists. viewLinkDisplay = message('view-link-display'), editLinkDisplay = message('edit-link-display'), historyLinkDisplay = message('history-link-display'), purgeLinkDisplay = message('purge-link-display'), preload = preload, createLinkDisplay = message('create-link-display') } end function p.renderStartBoxLinks(data) --[[ -- Generates the [view][edit][history][purge] or [create][purge] links from the data table. -- @data - a table of data generated by p.makeStartBoxLinksData --]] local docTitle = data.docTitle -- yes, we do intend to purge the template page on which the documentation appears local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay) if docTitle.exists then local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay) local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay) local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay) return "&#91;" .. viewLink .. "&#93; &#91;" .. editLink .. "&#93; &#91;" .. historyLink .. "&#93; &#91;" .. purgeLink .. "&#93;" else local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay) return "&#91;" .. createLink .. "&#93; &#91;" .. purgeLink .. "&#93;" end return ret end function p.makeStartBoxData(args, env, links) --[=[ -- Does initial processing of data to pass to the start-box render function, p.renderStartBox. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error. -- -- Messages: -- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]' -- 'template-namespace-heading' --> 'Template documentation' -- 'module-namespace-heading' --> 'Module documentation' -- 'file-namespace-heading' --> 'Summary' -- 'other-namespaces-heading' --> 'Documentation' -- 'testcases-create-link-display' --> 'create' --]=] local subjectSpace = env.subjectSpace if not subjectSpace then -- Default to an "other namespaces" namespace, so that we get at least some output -- if an error occurs. subjectSpace = 2 end local data = {} -- Heading local heading = args.heading -- Blank values are not removed. if heading == '' then -- Don't display the start box if the heading arg is defined but blank. return nil end if heading then data.heading = heading elseif subjectSpace == 10 then -- Template namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading') elseif subjectSpace == 828 then -- Module namespace data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading') elseif subjectSpace == 6 then -- File namespace data.heading = message('file-namespace-heading') else data.heading = message('other-namespaces-heading') end -- Heading CSS local headingStyle = args['heading-style'] if headingStyle then data.headingStyleText = headingStyle else -- 'documentation-heading' data.headingClass = message('main-div-heading-class') end -- Data for the [view][edit][history][purge] or [create] links. if links then -- 'mw-editsection-like plainlinks' data.linksClass = message('start-box-link-classes') data.links = links end return data end function p.renderStartBox(data) -- Renders the start box html. -- @data - a table of data generated by p.makeStartBoxData. local sbox = mw.html.create('div') sbox -- 'documentation-startbox' :addClass(message('start-box-class')) :newline() :tag('span') :addClass(data.headingClass) :attr('id', 'documentation-heading') :cssText(data.headingStyleText) :wikitext(data.heading) local links = data.links if links then sbox:tag('span') :addClass(data.linksClass) :attr('id', data.linksId) :wikitext(links) end return tostring(sbox) end ---------------------------------------------------------------------------- -- Documentation content ---------------------------------------------------------------------------- p.content = makeInvokeFunc('_content') function p._content(args, env) -- Displays the documentation contents -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment env = env or p.getEnvironment(args) local docTitle = env.docTitle local content = args.content if not content and docTitle and docTitle.exists then content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText} end -- The line breaks below are necessary so that "=== Headings ===" at the start and end -- of docs are interpreted correctly. return '\n' .. (content or '') .. '\n' end p.contentTitle = makeInvokeFunc('_contentTitle') function p._contentTitle(args, env) env = env or p.getEnvironment(args) local docTitle = env.docTitle if not args.content and docTitle and docTitle.exists then return docTitle.prefixedText else return '' end end ---------------------------------------------------------------------------- -- End box ---------------------------------------------------------------------------- p.endBox = makeInvokeFunc('_endBox') function p._endBox(args, env) --[=[ -- This function generates the end box (also known as the link box). -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- --]=] -- Get environment data. env = env or p.getEnvironment(args) local subjectSpace = env.subjectSpace local docTitle = env.docTitle if not subjectSpace or not docTitle then return nil end -- Check whether we should output the end box at all. Add the end -- box by default if the documentation exists or if we are in the -- user, module or template namespaces. local linkBox = args['link box'] if linkBox == 'off' or not ( docTitle.exists or subjectSpace == 2 or subjectSpace == 828 or subjectSpace == 10 ) then return nil end -- Assemble the link box. local text = '' if linkBox then text = text .. linkBox else text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]." if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then -- We are in the user, template or module namespaces. -- Add sandbox and testcases links. -- "Editors can experiment in this template's sandbox and testcases pages." text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />' if not args.content and not args[1] then -- "Please add categories to the /doc subpage." -- Don't show this message with inline docs or with an explicitly specified doc page, -- as then it is unclear where to add the categories. text = text .. (p.makeCategoriesBlurb(args, env) or '') end text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template" end end local box = mw.html.create('div') -- 'documentation-metadata' box:attr('role', 'note') :addClass(message('end-box-class')) -- 'plainlinks' :addClass(message('end-box-plainlinks')) :wikitext(text) :done() return '\n' .. tostring(box) end function p.makeDocPageBlurb(args, env) --[=[ -- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)". -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'edit-link-display' --> 'edit' -- 'history-link-display' --> 'history' -- 'transcluded-from-blurb' --> -- 'The above [[Wikipedia:Template documentation|documentation]] -- is [[Help:Transclusion|transcluded]] from $1.' -- 'module-preload' --> 'Template:Documentation/preload-module-doc' -- 'create-link-display' --> 'create' -- 'create-module-doc-blurb' --> -- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].' --]=] local docTitle = env.docTitle if not docTitle then return nil end local ret if docTitle.exists then -- /doc exists; link to it. local docLink = makeWikilink(docTitle.prefixedText) local editDisplay = message('edit-link-display') local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay) local historyDisplay = message('history-link-display') local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay) ret = message('transcluded-from-blurb', {docLink}) .. ' ' .. makeToolbar(editLink, historyLink) .. '<br />' elseif env.subjectSpace == 828 then -- /doc does not exist; ask to create it. local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')} local createDisplay = message('create-link-display') local createLink = makeUrlLink(createUrl, createDisplay) ret = message('create-module-doc-blurb', {createLink}) .. '<br />' end return ret end function p.makeExperimentBlurb(args, env) --[[ -- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- -- Messages: -- 'sandbox-link-display' --> 'sandbox' -- 'sandbox-edit-link-display' --> 'edit' -- 'compare-link-display' --> 'diff' -- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'sandbox-create-link-display' --> 'create' -- 'mirror-edit-summary' --> 'Create sandbox version of $1' -- 'mirror-link-display' --> 'mirror' -- 'mirror-link-preload' --> 'Template:Documentation/mirror' -- 'sandbox-link-display' --> 'sandbox' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display'--> 'edit' -- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox' -- 'testcases-create-link-display' --> 'create' -- 'testcases-link-display' --> 'testcases' -- 'testcases-edit-link-display' --> 'edit' -- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases' -- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases' -- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.' -- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle local sandboxTitle = env.sandboxTitle local testcasesTitle = env.testcasesTitle local templatePage = templateTitle.prefixedText if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then return nil end -- Make links. local sandboxLinks, testcasesLinks if sandboxTitle.exists then local sandboxPage = sandboxTitle.prefixedText local sandboxDisplay = message('sandbox-link-display') local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay) local sandboxEditDisplay = message('sandbox-edit-link-display') local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay) local compareUrl = env.compareUrl local compareLink if compareUrl then local compareDisplay = message('compare-link-display') compareLink = makeUrlLink(compareUrl, compareDisplay) end sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink) else local sandboxPreload if subjectSpace == 828 then sandboxPreload = message('module-sandbox-preload') else sandboxPreload = message('template-sandbox-preload') end local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload} local sandboxCreateDisplay = message('sandbox-create-link-display') local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay) local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)}) local mirrorPreload = message('mirror-link-preload') local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary} if subjectSpace == 828 then mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary} end local mirrorDisplay = message('mirror-link-display') local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay) sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink) end if testcasesTitle.exists then local testcasesPage = testcasesTitle.prefixedText local testcasesDisplay = message('testcases-link-display') local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay) local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'} local testcasesEditDisplay = message('testcases-edit-link-display') local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay) -- for Modules, add testcases run link if exists if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then local testcasesRunLinkDisplay = message('testcases-run-link-display') local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink) else testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink) end else local testcasesPreload if subjectSpace == 828 then testcasesPreload = message('module-testcases-preload') else testcasesPreload = message('template-testcases-preload') end local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload} local testcasesCreateDisplay = message('testcases-create-link-display') local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay) testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink) end local messageName if subjectSpace == 828 then messageName = 'experiment-blurb-module' else messageName = 'experiment-blurb-template' end return message(messageName, {sandboxLinks, testcasesLinks}) end function p.makeCategoriesBlurb(args, env) --[[ -- Generates the text "Please add categories to the /doc subpage." -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'doc-link-display' --> '/doc' -- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.' --]] local docTitle = env.docTitle if not docTitle then return nil end local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display')) return message('add-categories-blurb', {docPathLink}) end function p.makeSubpagesBlurb(args, env) --[[ -- Generates the "Subpages of this template" link. -- @args - a table of arguments passed by the user -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'template-pagetype' --> 'template' -- 'module-pagetype' --> 'module' -- 'default-pagetype' --> 'page' -- 'subpages-link-display' --> 'Subpages of this $1' --]] local subjectSpace = env.subjectSpace local templateTitle = env.templateTitle if not subjectSpace or not templateTitle then return nil end local pagetype if subjectSpace == 10 then pagetype = message('template-pagetype') elseif subjectSpace == 828 then pagetype = message('module-pagetype') else pagetype = message('default-pagetype') end local subpagesLink = makeWikilink( 'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/', message('subpages-link-display', {pagetype}) ) return message('subpages-blurb', {subpagesLink}) end ---------------------------------------------------------------------------- -- Tracking categories ---------------------------------------------------------------------------- function p.addTrackingCategories(env) --[[ -- Check if {{documentation}} is transcluded on a /doc or /testcases page. -- @env - environment table containing title objects, etc., generated with p.getEnvironment -- Messages: -- 'display-strange-usage-category' --> true -- 'doc-subpage' --> 'doc' -- 'testcases-subpage' --> 'testcases' -- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage' -- -- /testcases pages in the module namespace are not categorised, as they may have -- {{documentation}} transcluded automatically. --]] local title = env.title local subjectSpace = env.subjectSpace if not title or not subjectSpace then return nil end local subpage = title.subpageText local ret = '' if message('display-strange-usage-category', nil, 'boolean') and ( subpage == message('doc-subpage') or subjectSpace ~= 828 and subpage == message('testcases-subpage') ) then ret = ret .. makeCategoryLink(message('strange-usage-category')) end return ret end return p 268dc89480af10873bfbca5439ae8e61b404f770 MediaWiki:Common.css 8 9 68 13 2023-08-02T22:50:33Z Plantility 2 css text/css /* CSS placed here will be applied to all skins */ f23a4358c198efde0025fa6fb8082854aa392a65 Module:Infobox/styles.css 828 34 70 69 2023-08-02T22:51:45Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia text text/plain /* {{pp|small=y}} */ /* * This TemplateStyles sheet deliberately does NOT include the full set of * infobox styles. We are still working to migrate all of the manual * infoboxes. See [[MediaWiki talk:Common.css/to do#Infobox]] * DO NOT ADD THEM HERE */ /* * not strictly certain these styles are necessary since the modules now * exclusively output infobox-subbox or infobox, not both * just replicating the module faithfully */ .infobox-subbox { padding: 0; border: none; margin: -3px; width: auto; min-width: 100%; font-size: 100%; clear: none; float: none; background-color: transparent; } .infobox-3cols-child { margin: auto; } .infobox .navbar { font-size: 100%; } /* T281642 */ body.skin-minerva .infobox-header, body.skin-minerva .infobox-subheader, body.skin-minerva .infobox-above, body.skin-minerva .infobox-title, body.skin-minerva .infobox-image, body.skin-minerva .infobox-full-data, body.skin-minerva .infobox-below { text-align: center; } e8de6d96f4fde53afc4a6b0fed534405ab59b0a7 Template:Template other 10 35 72 71 2023-08-02T22:51:46Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia wikitext text/x-wiki {{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:Template}} | template | other }} }} | template = {{{1|}}} | other | #default = {{{2|}}} }}<!--End switch--><noinclude> {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude> 06fb13d264df967b5232141067eb7d2b67372d76 Template:Infobox settlement/styles.css 10 36 74 73 2023-08-02T22:51:46Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia text text/plain /* {{pp|small=y}} */ .ib-settlement { width: 23em; border-collapse: collapse; line-height: 1.2em; } /* TODO split definitions to appropriate class names when live from HTML element */ .ib-settlement td, .ib-settlement th { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.4em 0.6em; } .ib-settlement .mergedtoprow .infobox-full-data, .ib-settlement .mergedtoprow .infobox-header, .ib-settlement .mergedtoprow .infobox-data, .ib-settlement .mergedtoprow .infobox-label, .ib-settlement .mergedtoprow .infobox-below { border-top: 1px solid #a2a9b1; padding: 0.4em 0.6em 0.2em 0.6em; } .ib-settlement .mergedrow .infobox-full-data, .ib-settlement .mergedrow .infobox-data, .ib-settlement .mergedrow .infobox-label { border: 0; padding: 0 0.6em 0.2em 0.6em; } .ib-settlement .mergedbottomrow .infobox-full-data, .ib-settlement .mergedbottomrow .infobox-data, .ib-settlement .mergedbottomrow .infobox-label { border-top: 0; border-bottom: 1px solid #a2a9b1; padding: 0 0.6em 0.4em 0.6em; } .ib-settlement .maptable { border: 0; padding: 0; } .ib-settlement .infobox-header, .ib-settlement .infobox-below { text-align: left; } .ib-settlement .infobox-above { font-size: 125%; line-height: 1.3em; } .ib-settlement .infobox-subheader { background-color: #cddeff; font-weight: bold; } .ib-settlement-native { font-weight: normal; padding-top: 0.2em; } .ib-settlement-other-name { font-size: 78%; } .ib-settlement-official { font-weight: bold; } .ib-settlement-caption { padding: 0.3em 0 0 0; } .ib-settlement-caption-link { padding: 0.2em 0; } .ib-settlement-nickname { display: inline; } .ib-settlement-fn { font-weight: normal; display: inline; } bcad428737f5a62eb7bced25a38fccbd46dde186 Template:Infobox settlement/columns 10 37 76 75 2023-08-02T22:51:47Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia wikitext text/x-wiki <templatestyles src="Infobox settlement/columns/styles.css"/> <div class="ib-settlement-cols"> <div class="ib-settlement-cols-row">{{#if:{{{0|}}} |<!-- if 0 -->{{#if:{{{1|}}}{{{2|}}}{{{3|}}}{{{4|}}}{{{5|}}} |<!-- if 0 and (1 or 2 or 3 or 4 or 5) --><div class="ib-settlement-cols-cellt"> {{#if:{{{1|}}}|<div>{{{1}}}</div>}} {{#if:{{{2|}}}|<div>{{{2}}}</div>}} {{#if:{{{3|}}}|<div>{{{3}}}</div>}} {{#if:{{{4|}}}|<div>{{{4}}}</div>}} {{#if:{{{5|}}}|<div>{{{5}}}</div>}} </div> }}<div class="ib-settlement-cols-cellt">{{{0}}}</div> |<!-- if not 0 -->{{#ifexpr:({{#if:{{{1|}}}|1|0}}+{{#if:{{{2|}}}|1|0}}+{{#if:{{{3|}}}|1|0}}+{{#if:{{{4|}}}|1|0}}) > 2 |<!-- if more than two images -->{{#if:{{{1|}}} |<div class="ib-settlement-cols-cell">{{{1}}}</div>{{#if:{{{2|}}}||</div></div><div class="ib-settlement-cols"><!-- TODO: The "3" element case currently produces two div-tables, which is non-optimal, but someone else should figure out how to fix it; 4 and 2 cases output as one "table". --><div class="ib-settlement-cols-row">}} }}{{#if:{{{2|}}} |<div class="ib-settlement-cols-cell">{{{2}}}</div>{{#if:{{{1|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}} }}</div><div class="ib-settlement-cols-row">{{#if:{{{3|}}} |{{#if:{{{4|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{3}}}</div> }}{{#if:{{{4|}}} |{{#if:{{{3|}}}||</div></div><div class="ib-settlement-cols"><div class="ib-settlement-cols-row">}}<div class="ib-settlement-cols-cell">{{{4}}}</div> }} |<!-- if two or fewer images -->{{#if:{{{1|}}}|<div class="ib-settlement-cols-cell">{{{1}}}</div>}}<!-- -->{{#if:{{{2|}}}|<div class="ib-settlement-cols-cell">{{{2}}}</div>}}<!-- -->{{#if:{{{3|}}}|<div class="ib-settlement-cols-cell">{{{3}}}</div>}}<!-- -->{{#if:{{{4|}}}|<div class="ib-settlement-cols-cell">{{{4}}}</div>}} }} }}</div></div><noinclude> {{documentation}} </noinclude> bdd926fcf77e5f0f9f899ac6b2e23cd7efc8584e Template:If empty 10 38 78 77 2023-08-02T22:51:47Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia wikitext text/x-wiki {{<includeonly>safesubst:</includeonly>#invoke:If empty|main}}<noinclude>{{Documentation}}</noinclude> 745940b7bdde8a1585c887ee4ee5ce81d98461a4 Template:Main other 10 39 80 79 2023-08-02T22:51:48Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia wikitext text/x-wiki {{#switch: <!--If no or empty "demospace" parameter then detect namespace--> {{#if:{{{demospace|}}} | {{lc: {{{demospace}}} }} <!--Use lower case "demospace"--> | {{#ifeq:{{NAMESPACE}}|{{ns:0}} | main | other }} }} | main = {{{1|}}} | other | #default = {{{2|}}} }}<noinclude> {{documentation}} <!-- Add categories to the /doc subpage; interwikis go to Wikidata, thank you! --> </noinclude> 86ad907ffeea3cc545159e00cd1f2d6433946450 Template:Location map 10 40 82 81 2023-08-02T22:51:48Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia wikitext text/x-wiki <includeonly>{{#invoke:Location map|main}}</includeonly><noinclude>{{documentation}}</noinclude> 732416b8068d2dc3549db5aa5ffa786beb502886 Template:Infobox settlement/densdisp 10 42 86 85 2023-08-02T22:51:49Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia wikitext text/x-wiki <includeonly>{{#if: {{#iferror:{{#expr:-{{formatnum:{{{/km2}}}|R}}}} |{{#iferror:{{#expr:-{{formatnum:{{{/sqmi}}}|R}}}} |{{#switch:auto |{{{/km2}}}|{{{/sqmi}}}={{#iferror:{{#expr:-{{formatnum:{{{pop}}}|R}}}} ||{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{ha|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{km2|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{acre|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{sqmi|}}}|R}}}}}} +{{#iferror:{{#expr:{{formatnum:{{{dunam|}}}|R}}}}}} +0 >0 |1}} }} }} |1 }} |1 }} |{{infobox settlement/{{infobox settlement/pref|{{{pref}}}|{{{name}}}}} |metv={{#iferror:{{#expr:-{{formatnum:{{{/km2}}}|R}}}} |{{#iferror:{{#expr:-{{formatnum:{{{/sqmi}}}|R}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{km2|}}}|R}}}}}}+0>0 |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{ha|}}}|R}}}}}}+0>0 |{{round|{{#expr:100*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:100*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{dunam|}}}|R}}}}}}+0>0 |{{round|{{#expr:1000*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:1000*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{sqmi|}}}|R}}}}}}+0>0 |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}/2.589988110336}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}/2.589988110336}}}}}}}} |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}/0.004046856422}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}/0.004046856422}}}}}}}} }}}}}}}} |{{round |{{#expr:{{formatnum:{{{/sqmi}}}|R}}/2.589988110336}} |{{max |{{precision|{{formatnum:{{{/sqmi}}}|R}}}} |-{{Order of magnitude|{{#expr:{{formatnum:{{{/sqmi}}}|R}}/2.589988110336}}}} }} }} }} |{{{/km2}}} }} |metu=km<sup>2</sup> |impv={{#iferror:{{#expr:-{{formatnum:{{{/sqmi}}}|R}}}} |{{#iferror:{{#expr:-{{formatnum:{{{/km2}}}|R}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{sqmi|}}}|R}}}}}}+0>0 |{{round|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{sqmi}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{acre|}}}|R}}}}}}+0>0 |{{round|{{#expr:640*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:640*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{acre}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{km2|}}}|R}}}}}}+0>0 |{{round|{{#expr:2.589988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:2.589988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{km2}}}|R}}}}}}}}}} |{{#ifexpr:{{#iferror:{{#expr:{{formatnum:{{{ha|}}}|R}}}}}}+0>0 |{{round|{{#expr:258.9988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:258.9988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{ha}}}|R}}}}}}}}}} |{{round|{{#expr:2589.988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}<!-- -->|{{#expr:1-{{Order of magnitude|{{#expr:2589.988110336*{{formatnum:{{{pop}}}|R}}/{{formatnum:{{{dunam}}}|R}}}}}}}}}} }}}}}}}} |{{round |{{#expr:{{formatnum:{{{/km2}}}|R}}*2.589988110336}} |{{max |{{#expr:{{precision|{{formatnum:{{{/km2}}}|R}}}}-1}} |-{{Order of magnitude|{{#expr:{{formatnum:{{{/km2}}}|R}}*2.589988110336}}}} }} }} }} |{{{/sqmi}}} }} |impu=sq&nbsp;mi |s=/ }} }}</includeonly><noinclude> {{documentation}} </noinclude> 8d2587f8008e5720272fd3abbbdd54f8c8dc306a Module:Check for clobbered parameters 828 43 88 87 2023-08-02T22:51:49Z Plantility 2 1 revision imported: More importing of templates & modules from Wikipedia Scribunto text/plain local p = {} local function trim(s) return s:match('^%s*(.-)%s*$') end local function isnotempty(s) return s and s:match('%S') end function p.check(frame) local args = frame.args local pargs = frame:getParent().args local checknested = isnotempty(args['nested']) local delimiter = isnotempty(args['delimiter']) and args['delimiter'] or ';' local argpairs = {} for k, v in pairs(args) do if type(k) == 'number' then local plist = mw.text.split(v, delimiter) local pfound = {} local count = 0 for ii, vv in ipairs(plist) do vv = trim(vv) if checknested and pargs[vv] or isnotempty(pargs[vv]) then count = count + 1 table.insert(pfound, vv) end end if count > 1 then table.insert(argpairs, pfound) end end end local warnmsg = {} local res = '' local cat = '' if args['cat'] and mw.ustring.match(args['cat'],'^[Cc][Aa][Tt][Ee][Gg][Oo][Rr][Yy]:') then cat = args['cat'] end local template = args['template'] and ' in ' .. args['template'] or '' if #argpairs > 0 then for i, v in ipairs( argpairs ) do table.insert( warnmsg, mw.ustring.format( 'Using more than one of the following parameters%s: <code>%s</code>.', template, table.concat(v, '</code>, <code>') ) ) if cat ~= '' then res = res .. '[[' .. cat .. '|' .. (v[1] == '' and ' ' or '') .. v[1] .. ']]' end end end if #warnmsg > 0 then res = require('Module:If preview')._warning({ table.concat(warnmsg, '<br>') }) .. res end return res end return p 2d18fb6802fa261d88a0e135ab147ab9f062acde